I just started to work on a new nextjs project, but when I run npm run dev, it exit with this error :
$ npm run dev
> bookguessr2@0.1.0 dev
> next dev --turbopack
▲ Next.js 15.2.4 (Turbopack)
- Local: http://localhost:3000
- Network: http://192.168.1.117:3000
✓ Starting...
Using cached swc package @next/swc-linux-x64-gnu...
Using cached swc package @next/swc-linux-x64-musl...
[Error: Cannot find module 'next/package.json'
Require stack:
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/dev/hot-reloader-webpack.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-server.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/start-server.js] {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
}
✓ Ready in 3.2s
○ Compiling /modeLibre ...
✓ Compiled /modeLibre in 5.5s
GET /modeLibre 200 in 5649ms
✓ Compiled /api/get-excerpt in 273ms
⨯ [Error: Cannot find module 'next/dist/compiled/babel/code-frame'
Require stack:
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/shared/lib/turbopack/utils.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/swc/index.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/analysis/parse-module.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/analysis/get-page-static-info.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-server.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/start-server.js] {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
}
⨯ [Error: Cannot find module 'next/dist/compiled/babel/code-frame'
Require stack:
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/shared/lib/turbopack/utils.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/swc/index.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/analysis/parse-module.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/analysis/get-page-static-info.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-server.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/start-server.js] {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
}
[Error: Cannot find module 'next/dist/compiled/babel/code-frame'
Require stack:
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/shared/lib/turbopack/utils.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/swc/index.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/analysis/parse-module.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/build/analysis/get-page-static-info.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-server.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/start-server.js] {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
}
Even if I did a rm -rf node_modules package-lock.json .next
multiple times.
Any idea ?
Here is my package.json : { "name": "bookguessr2", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev --turbopack", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "next": "15.2.4", "react": "^18.3.1", "react-dom": "^18.0.0", "sqlite": "^5.1.1", "sqlite3": "^5.1.7" }, "devDependencies": { "@eslint/eslintrc": "^3", "@tailwindcss/postcss": "^4", "eslint": "^9", "eslint-config-next": "15.2.4", "tailwindcss": "^4" } }
I tried disabling turbopack, but then I got this error :
~$ npx next dev
▲ Next.js 15.2.4
- Local: http://localhost:3000
- Network: http://192.168.1.117:3000
✓ Starting...
[Error: Cannot find module '@swc/helpers/_/_interop_require_wildcard'
Require stack:
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/client/components/react-dev-overlay/font/get-dev-overlay-font-middleware.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/dev/hot-reloader-webpack.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/router-server.js
- /home/nathi/Téléchargements/a/bookguessr2/node_modules/next/dist/server/lib/start-server.js] {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
}
My project was in the "Téléchargements" folder, and I think that the non-ascii letters caused the problem, because I moved it into my home directory and it worked fine.