How to fix npm ERR! code EMISSING npm ERR! missing: package@version, required by project in npm

npmBEGINNERMEDIUMUpdated Dec 6, 2025· 202 views

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
  1. Clean reinstall dependencies
  2. Clear npm cache
  3. Verify the missing package exists
  4. Check dependency tree for gaps
npm — error
# Remove existing artifacts
rm -rf node_modules package-lock.json
# Reinstall from scratch
npm install
npm ERR! code EMISSING
npm 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

  1. Corrupted or outdated package-lock.json inconsistent with package.json
  2. Installation interrupted or failed midway leaving node_modules incomplete
  3. Switching between npm and Yarn introduces incompatible lockfile formats
  4. Optional dependencies with nested requirements failed to install
  5. npm version bugs in v5.x with linked packages and dependency resolution
  6. Transitive dependency gaps where parent installed but sub-dependencies missing
  7. Network interruption during package download

How to fix "npm ERR! code EMISSING npm ERR! missing: package@version, required by project"

1Clean reinstall dependencies

Delete both node_modules and lockfile to force a fresh dependency tree:

bash
# Remove existing artifacts
rm -rf node_modules package-lock.json

# Reinstall from scratch
npm install

This forces npm to rebuild the entire dependency tree from package.json.

2Clear npm cache

Remove potentially corrupted cache entries:

bash
# Force clear the cache
npm cache clean --force

# Verify cache integrity
npm cache verify

# Then reinstall
npm install
3Verify the missing package exists

Check if the package and version are available:

bash
# 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.

4Check dependency tree for gaps

Use npm list to identify missing dependencies:

bash
# Show full dependency tree
npm list

# Show only problems
npm list 2>&1 | grep -i "missing\|UNMET"

Install any packages reported as missing.

5Upgrade Node.js and npm

Older npm versions have known dependency resolution bugs:

bash
# 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 --lts
6Use npm ci for reproducible installs

In CI/CD environments, use npm ci instead of npm install:

bash
# Clean install from lockfile (requires package-lock.json)
npm ci

npm 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