新鲜的 NextJS 应用程序在任何更改之前抛出错误 [英] Fresh NextJS App throwing errors before any changes

查看:15
本文介绍了新鲜的 NextJS 应用程序在任何更改之前抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确实做了npx create-next-app"、cd appfolder、npm run dev,但它已经消除了错误:

I literally did "npx create-next-app", cd appfolder, npm run dev, and it's blowing out errors already:

(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

Module list:
+-- eslint-config-next@11.1.1
+-- eslint@7.32.0
+-- next@11.1.1
+-- react-dom@17.0.2
`-- react@17.0.2

node -v = v14.17.5

所以一个处女 npx create-next-app,它甚至不能自己站起来.我对 NextJS/NodeJS 很陌生,但对编程、IT、Web 开发并不陌生.在我改变任何东西之前,这不应该能够在不爆炸的情况下开始吗?

So a virgin npx create-next-app, and it can't even stand up on it's own. I'm very new to NextJS / NodeJS, but not new to programming, IT, web development. Shouldn't this be able to start without blowing up before I even change anything???

推荐答案

我遇到了与您描述的完全相同的问题,就我的发现而言,这似乎是由于 重大更改 中的 next@11.1.1 仅影响 Windows.

I was experiencing the exact same issue as you described, and for what I’ve found, it seems to be due to a breaking change in next@11.1.1 which is only affecting Windows.

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

Until this gets fixed, you can downgrade Next to version 11.1.0:

npm install next@11.1.0

纱线添加 next@11.1.0

这篇关于新鲜的 NextJS 应用程序在任何更改之前抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆