我刚开始学习next.js。我安装了create-next-app
,试图启动一个开发服务器,而不改变样板文件提供的任何代码。我得到这个错误
./styles/globals.css
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://nextjs.org/docs/messages/css-global
Location: pages_app.js
我只是从nextjs开始,所以除了这个我没有任何其他信息,我没有改变任何代码
使用的命令
npx create-next-app next_js_list
cd next_js_list
npm run dev
这是包裹。json中有
{
"name": "next_js_list",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "11.1.1",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-next": "11.1.1"
}
}
我也一样,看起来像是新的next.js 11.1.1版本的错误,只要回到11.1.0,就会好的,很快就会修复