简体   繁体   English

Next.js - 即使在更新节点 js 后也无法加载 next.config.js?

[英]Next.js - Failed to load next.config.js even after updating node js?

Alright, I am trying to run my next.js on local host for development by running npx next dev at the root of the project.好的,我正在尝试通过在项目的根目录下运行 npx npx next dev来在本地主机上运行我的 next.js 以进行开发。 Upon doing this, I get logs that a local server was started and then the command fails with this error:执行此操作后,我得到本地服务器已启动的日志,然后命令失败并出现以下错误:

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:76651) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
Error: Not supported

I went to the link mentioned and saw "This could be due to a syntax error or attempting to require/import a module that wasn't available."我转到提到的链接并看到“这可能是由于语法错误或试图要求/导入不可用的模块。” I cloned a template project so I know I havent made any errors in the config file.我克隆了一个模板项目,所以我知道我没有在配置文件中犯任何错误。

Other SO posts mention this is due to Node JS and Next js being out of sync in versions.其他 SO 帖子提到这是由于 Node JS 和 Next js 在版本中不同步。 I updated Node JS and am now on most up to date v10.15.3.我更新了 Node JS,现在使用的是最新的 v10.15.3。

Given this is the Next template project, What is wrong here?鉴于这是下一个模板项目,这里有什么问题? How I can run my project locally for easy testing?如何在本地运行我的项目以便于测试?

如果您尝试在开发模式下运行项目,那么命令是npm run dev

Solved - updating node via command line didnt work.已解决 - 通过命令行更新节点不起作用。 Install latest node at https://nodejs.org/en/https://nodejs.org/en/安装最新节点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM