【问题标题】:Nextjs boiler plate development server giving errorNextjs 样板开发服务器报错
【发布时间】: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


    【解决方案1】:

    对我来说也一样,新的 next.js 版本 11.1.1 似乎有错误,回到 11.1.0 就可以了,很快就会修复

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-28
    • 1970-01-01
    • 2014-03-21
    • 1970-01-01
    • 1970-01-01
    • 2020-04-08
    相关资源
    最近更新 更多