NextJS本地启动出现「无法找到模块」错误,请求解决
NextJS项目启动本地服务报错解决方案
问题背景
使用npx create-next-app@latest创建NextJS项目后,启动本地服务时出现无法加载模块的错误。
项目package.json配置
{ "name": "test", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "autoprefixer": "10.4.14", "next": "13.4.1", "postcss": "8.4.23", "react": "18.2.0", "react-dom": "18.2.0", "tailwindcss": "3.3.2" } }
浏览器错误信息
caught Error: Could not find the module "C:\Users\OneDrive\Desktop\test\node_modules\next\dist\client\components\app-router.js#" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
解决步骤
- 删除项目根目录下的
.next和node_modules文件夹 - 清理npm缓存:
npm cache clean --force - 重新安装依赖:
npm install - 尝试升级Next.js到最新稳定版本:
npm install next@latest - 检查项目路径是否包含特殊字符或同步目录(比如当前路径包含OneDrive,建议将项目移动到本地普通路径如
C:\Projects\test) - 重新启动开发服务:
npm run dev
内容的提问来源于stack exchange,提问作者user21601455
相关产品推荐
相关产品推荐

