【发布时间】:2021-10-29 13:52:20
【问题描述】:
我刚刚开始学习 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
这是我的 package.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"
}
}
【问题讨论】:
标签: javascript reactjs next.js server-side-rendering