#getting module not found error
1 messages · Page 1 of 1 (latest)
In Next.js 16, the default bundler changed to Turbopack, and a number of users are seeing “Module not found: Can’t resolve …” errors after adding or changing packages, even though the packages are installed correctly. [Upgrade to 16]
From the issues in the knowledge sources, this can happen when:
- Turbopack fails to resolve installed npm packages that Webpack can resolve just fine. [Turbopack resolution fails; react-map-gl issue]
- Turbopack has trouble with local / workspace / file-based packages (e.g.
file:../some-module, monorepo packages, or locallibpackages). [Local package fail; file: dependency; monorepo sibling] - The
node_moduleslayout changes between installs (especially with pnpm), causing Turbopack’s hashed external module references to no longer match. [Hash mismatch]
Because of this, the same code often works with Webpack but fails with Turbopack. [Turbopack vs webpack; downgrading fixes]
What you can try
-
Confirm it’s a Turbopack issue by using Webpack
Temporarily opt out of Turbopack:
{ "scripts": { "dev": "next dev --webpack", "build": "next build --webpack", "start": "next start" } }
If the error disappears with --webpack, you’re hitting one of the known Turbopack resolution problems. [Upgrade to 16; workaround]
-
If you’re using local / workspace packages
Be aware that several reports show Turbopack not resolving them even though Webpack does. [Local package fail; file: dependency; monorepo sibling]
In that case, continuing with Webpack (--webpack) is currently the reliable workaround. -
If you’re deploying on Vercel
A “module not found” at build time usually means the static import path can’t be resolved by the bundler, even if the package is installed. [Other build errors]
Again, switching the build tonext build --webpackis a known workaround while Turbopack issues are being resolved. [Upgrade to 16]
The knowledge sources don’t explain why your editor “recommendations” (likely IntelliSense / auto-imports) stopped, so I can’t answer that part confidently. They only cover the build-time “module not found” behavior with Turbopack. If you share the exact error message and how you’re importing the new packages (normal dependency vs local workspace, etc.), I can map it more precisely to the known issues above.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@lusty apex Kapa.ai is still learning and improving, please let me know how I did by reacting below.