0

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

> [email protected] 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]
}

2 Answers 2

0

Its seems that your having dependencies issues, if

rm -rf node_modules package-lock.json .next

doesn't work, maybe try installing the sw/helpers

npm install @swc/helpers
Sign up to request clarification or add additional context in comments.

2 Comments

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
I tried multiple times, but it didn't work.
0

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.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.