How to fix npm ERR! code EMISSING npm ERR! missing: package@version, required by project in npm
The EMISSING error occurs when npm cannot find a required dependency during installation. This typically happens due to corrupted lockfiles, incomplete installations, or version mismatches between package.json and package-lock.json.
Quick fix
Fixes npm ERR! code EMISSING npm ERR! missing: package@version, required by project
# Remove existing artifacts
rm -rf node_modules package-lock.json
# Reinstall from scratch
npm install- Clean reinstall dependencies
- Clear npm cache
- Verify the missing package exists
- Check dependency tree for gaps
# Remove existing artifactsrm -rf node_modules package-lock.json# Reinstall from scratchnpm installnpm ERR! code EMISSINGnpm ERR! missing: package@version, required by project
What this error means
The EMISSING error indicates that npm's dependency resolver found a reference to a package that should exist but cannot be located. This happens when the dependency tree has become inconsistent—the lockfile or node_modules references a package that wasn't properly installed. This error commonly occurs after interrupted installations, when switching between npm and Yarn, or when package-lock.json becomes desynchronized from package.json. The error can also surface when optional dependencies have nested requirements that fail to install properly.
Typical symptoms
- npm install fails with "missing: package@version, required by project"
- Runtime errors show "Cannot find module" despite package being in package.json
- Subsequent npm install runs leave modules missing
- npm list command reports missing dependencies
- Project works after fresh clone but fails after reinstalling
- Switching between npm and Yarn causes resolution failures
Common causes
- Corrupted or outdated package-lock.json inconsistent with package.json
- Installation interrupted or failed midway leaving node_modules incomplete
- Switching between npm and Yarn introduces incompatible lockfile formats
- Optional dependencies with nested requirements failed to install
- npm version bugs in v5.x with linked packages and dependency resolution
- Transitive dependency gaps where parent installed but sub-dependencies missing
- Network interruption during package download
How to fix "npm ERR! code EMISSING npm ERR! missing: package@version, required by project"
Delete both node_modules and lockfile to force a fresh dependency tree:
# Remove existing artifacts
rm -rf node_modules package-lock.json
# Reinstall from scratch
npm installThis forces npm to rebuild the entire dependency tree from package.json.
Remove potentially corrupted cache entries:
# Force clear the cache
npm cache clean --force
# Verify cache integrity
npm cache verify
# Then reinstall
npm installCheck if the package and version are available:
# View available versions
npm view <package-name> versions
# Install specific version if needed
npm install <package-name>@<version>If the version doesn't exist, update package.json to use an available version.
Use npm list to identify missing dependencies:
# Show full dependency tree
npm list
# Show only problems
npm list 2>&1 | grep -i "missing\|UNMET"Install any packages reported as missing.
Older npm versions have known dependency resolution bugs:
# Check current versions
node -v
npm -v
# Upgrade npm
npm install -g npm@latest
# Or use nvm for Node upgrade
nvm install --lts
nvm use --ltsIn CI/CD environments, use npm ci instead of npm install:
# Clean install from lockfile (requires package-lock.json)
npm cinpm ci is stricter and fails fast if lockfile doesn't match package.json.
Advanced notes
This error is particularly common when teams mix npm and Yarn, or when CI/CD environments use different Node.js versions than local development. Always commit package-lock.json to version control and ensure consistent Node.js versions across environments.
For monorepos, EMISSING can occur when workspace packages reference each other incorrectly. Verify workspace configuration in package.json and ensure dependencies use the correct workspace protocol.
Prevention: Run npm audit regularly, use npm ci in CI pipelines, and avoid manual edits to package-lock.json.
Frequently asked questions
- What does "npm ERR! code EMISSING npm ERR! missing: package@version, required by" mean?
- The EMISSING error indicates that npm's dependency resolver found a reference to a package that should exist but cannot be located. This happens when the dependency tree has become inconsistent—the lockfile or node_modules references a package that wasn't properly installed. json.
- How do I fix "npm ERR! code EMISSING npm ERR! missing: package@version, required by"?
- The EMISSING error occurs when npm cannot find a required dependency during installation. This typically happens due to corrupted lockfiles, incomplete installations, or version mismatches between package.json and package-lock.json.
- What causes "npm ERR! code EMISSING npm ERR! missing: package@version, required by"?
- Corrupted or outdated package-lock.json inconsistent with package.json Installation interrupted or failed midway leaving node_modules incomplete Switching between npm and Yarn introduces incompatible lockfile formats
- Is the "npm ERR! code EMISSING npm ERR! missing: package@version, required by" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚npm Official Documentation
- 🔗
- 🐙GitHub #17282: npm/npm(GitHub)
- 💬Stack Overflow: npm install is missing modules(Stack Overflow)