ProjectStack
npm

ERR_MODULE_NOT_FOUND

Node.js (in ESM mode) couldn't find the module you're importing. This is the ESM equivalent of 'Cannot find module' — it appears when using import statements instead of require().

Common causes

  • The package isn't installed — run npm install
  • The import path is missing the file extension (.js is required in ESM)
  • Importing a relative file without including .js: import './utils' should be import './utils.js'
  • A package was removed from node_modules but is still referenced in code

How to fix it

  1. Install missing packages: npm install <package-name>
  2. Add .js extension to local imports: change import './helper' to import './helper.js'
  3. Delete node_modules and reinstall: rm -rf node_modules && npm install
  4. Check that the package name in the import matches exactly what's in package.json

Example

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/user/project/src/utils' imported from /home/user/project/src/index.js Did you mean to import ../utils/index.js?

Using ESM import without the .js extension on a local file path

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.