【发布时间】:2021-12-15 06:57:30
【问题描述】:
我从 git 中提取了一个 nextJS 应用程序,并尝试使用 npm run dev ,npx next dev npm run start 启动它,事实上,我运行的每个命令都给了我同样的错误。
为了进一步排除故障,我按照 youtube 教程开始了一个全新的项目,运行 npx create-next-app appname 并再次运行。同样的错误。
H:\Documents\Projects\React\NextTutorial\ninjalist>npm run dev ninjalist@0.1.0 dev next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error Error: Not supported at Object.loadConfig [as default] (H:\Documents\Projects\React\NextTutorial\ninjalist\node_modules\next\dist\server\config.js:399:74) at async NextServer.loadConfig (H:\Documents\Projects\React\NextTutorial\ninjalist\node_modules\next\dist\server\next.js:110:22) at async NextServer.prepare (H:\Documents\Projects\React\NextTutorial\ninjalist\node_modules\next\dist\server\next.js:92:24) at async H:\Documents\Projects\React\NextTutorial\ninjalist\node_modules\next\dist\cli\next-dev.js:126:9
最突出的是它无法加载next.config.js
该文件的内容很简单
/** @type {import('next').NextConfig} */ module.exports = { reactStrictMode: true, }
感谢我是否可以被告知我缺少什么,因为我没有编写任何代码,这直接来自创建应用程序,我收到了这个错误。 感谢您的帮助。
【问题讨论】: