使用npm
开始打开create-react-app 时出现以下错误。我是React的新手,过去几天我在做命令行以创建新应用程序时没有遇到任何问题。
我已尝试npx
启动,npm
启动并npm
重新安装更新版本。
Failed to compile
./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
BrowserslistError: Unknown browser query `android all`. Maybe you are using old Browserslist or made typo in query.
at Array.reduce (<anonymous>)
at Array.some (<anonymous>)
at Array.filter (<anonymous>)
Run Code Online (Sandbox Code Playgroud) 我正在尝试学习nextjs。正在努力使用getServerSideProps
.
使用免费的 api,我在 DOM 上显示了一个国家列表。我想动态链接到一个国家/地区,并为该特定国家/地区获取和显示数据。
到目前为止,这是我的代码
const Country = props => (
<Layout>
<h1>{props.country.name}</h1>
<span>{props.country.capital}</span>
</Layout>
);
export async function getServerSideProps(context) {
const { id } = context.query;
const res = await fetch(`https://restcountries.eu/rest/v2/name/${id}`);
const country = await res.json();
console.log(`Fetched place: ${country.name}`);
return { props: { country } };
}
export default Country;
Run Code Online (Sandbox Code Playgroud)
<div className='container'>
<Head>
<title>Countries List</title>
<link rel='icon' href='/favicon.ico' />
</Head>
<Layout>
<main>
<h1>
Countries{' '}
<span role='img' aria-label='world emoji'>
</span>
</h1>
<ul>
{countries.map(country => (
<li …
Run Code Online (Sandbox Code Playgroud) 我npm install --save gatsby-transformer-sharp gatsby-plugin-sharp,然后这样做后,我无法运行我的项目,并且遇到了这些奇怪的错误:
(sharp:7804): GLib-GObject-WARNING **: 14:10:08.042: cannot register existing type 'VipsObject'
(sharp:7804): GLib-CRITICAL **: 14:10:08.043: g_once_init_leave: assertion 'result != 0' failed
(sharp:7804): GLib-GObject-CRITICAL **: 14:10:08.043: g_type_register_static: assertion 'parent_type > 0' failed
(sharp:7804): GLib-CRITICAL **: 14:10:08.043: g_once_init_leave: assertion 'result != 0' failed
Run Code Online (Sandbox Code Playgroud)