新的 NextJS 应用程序在任何更改之前都会抛出错误

8 next.js

我确实做到了npx create-next-app,,,并且它已经消除了错误cd appfoldernpm run dev

(node:7636) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
(Use `node --trace-deprecation ...` to show where the warning was created)
error - ./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
Run Code Online (Sandbox Code Playgroud)

模块列表:

  • eslint-config-next@11.1.1
  • eslint@7.32.0
  • 下一个@11.1.1
  • 反应-dom@17.0.2
  • 反应@17.0.2

节点-v = v14.17.5

Rod*_*ino 16

我遇到了与您描述的完全相同的问题,对于我发现的情况,这似乎是由于仅影响 Windows 的重大更改所致next@11.1.1

\n

在这个问题得到解决之前,您可以将 Next 降级到版本 11.1.0:

\n

npm install next@11.1.0

\n

yarn add next@11.1.0

\n