我使用 npx create-next-app ./ 创建了一个新的 next.js 应用程序 ./
我没有触及任何代码,甚至没有在编辑器中打开它。
使用 npm run dev
运行此应用程序时,我收到这些非常长的警告。
$ npm run dev > test@0.1.0 dev > next dev - ready started server on 0.0.0.0:3000, url: http://localhost:3000 - event compiled client and server successfully in 1605 ms (20 modules) - wait compiling... - event compiled client and server successfully in 593 ms (20 modules) - wait compiling /page (client and server)... - warn ./node_modules/next/dist/client/add-base-path.js There are multiple modules with names that only differ in casing. This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. Use equal casing. Compare these module identifiers: * javascript/auto|C:\Users\Admin\Desktop\Desktop\WD\NEXTjs\test\test\node_modules\next\dist\compiled\@next\react-refresh-utils\dist\loader.js!C:\Users\Admin\Desktop\Desktop\WD\NEXTjs\test\test\node_modules\next\dist\build\webpack\loaders\next-flight-client-module-loader.js!C:\Users\Admin\Desktop\Desktop\WD\NEXTjs\test\test\node_modules\next\dist\build\webpack\loaders\next-swc-loader.js??ruleSet[1].rules[6].oneOf[4].use[2]!C:\Users\Admin\Desktop\Desktop\WD\NEXTjs\test\test\node_modules\next\dist\client\add-base-path.js|app-client Used by 3 module(s), i. e. javascript/auto|C:\Users\Admin\Desktop\Desktop\WD\NEXTjs\test\test\node_modules\next\dist\compiled\@next\react-refresh-utils\dist\loader.js!C:\Users\Admin\Desktop\Desktop\WD\NEXTjs\test\test\node_modules\next\dist\build\.................
页面已加载。
P粉4884647312024-02-22 12:49:19
我认为您只需要删除 ./
然后运行命令即可。
npx create-next-app@latest
之后,当命令询问项目名称时,只需写入 .
并按 Enter。
P粉3409802432024-02-22 12:10:06
我发现了问题。 Next.js 不喜欢将应用程序放在 Desktop/desktop/... 文件夹中,因此它会抛出错误。我刚刚更改了文件夹名称并且它起作用了。