How to fix npm ERR! code EMISSINGARG npm ERR! Missing required argument: package name in npm

npmBEGINNERMEDIUMUpdated Dec 5, 2025ยท 159 views

This EMISSINGARG error occurs when npm expects a package name argument but none was provided. Include the package name when using installation flags like --save or -g.

Quick fix

Fixes EMISSINGARG

# Correct - includes package name
npm install express
npm install express --save
npm install nodemon -g
npm install --save-dev jest

# Incorrect - missing package name (causes EMISSINGARG)
npm install --save
npm install -g
npm install --save-dev
  1. Verify your npm command syntax
  2. Check and upgrade your npm version
  3. Use Node Version Manager (nvm) for clean updates
  4. Clean npm cache if upgrading doesn't work
npm โ€” error
# Correct - includes package name
npm install express
npm install express --save
npm install nodemon -g
npm install --save-dev jest
# Incorrect - missing package name (causes EMISSINGARG)
npm install --save
npm install -g
npm install --save-dev
npm ERR! code EMISSINGARG
npm ERR! Missing required argument: package name

What this error means

This error occurs when npm expects a package name argument but none was provided. The EMISSINGARG error code indicates a missing required argument #1, which is typically the package name. In most cases, developers have used `npm install` with a flag like `--save`, `-g`, or `--save-dev` but forgot to specify which package to install. However, this error can also be triggered by using an outdated version of npm (particularly versions 3.x), where npm's dependency resolution fails unexpectedly even on valid commands.

Typical symptoms

  • npm command fails with 'ERR! code EMISSINGARG' and 'Missing required argument: package name'
  • Error appears when running commands like 'npm install --save' or 'npm install -g' without a package name
  • Commands that previously worked suddenly fail with EMISSINGARG in CI/CD environments
  • npm install commands hang or fail with TypeError about missing argument #1
  • Global package installation commands (npm install -g) fail unexpectedly

Common causes

  1. Forgot to specify a package name when using installation flags (--save, -g, --save-dev, --save-optional)
  2. Using an outdated version of npm (versions 3.5.x to 3.10.x are known to have this issue)
  3. Corrupted or outdated Node.js version installed via system package manager rather than nvm
  4. npm cache is corrupted or npm registry metadata is invalid for a dependency
  5. Using npm 6.x or earlier in a CI/CD pipeline where npm wasn't properly initialized
  6. Custom npm configuration (in .npmrc) has invalid syntax or deprecated settings

How to fix "npm ERR! code EMISSINGARG npm ERR! Missing required argument: package name"

1Verify your npm command syntax

First, check that you're providing a package name when using installation flags:

bash
# Correct - includes package name
npm install express
npm install express --save
npm install nodemon -g
npm install --save-dev jest

# Incorrect - missing package name (causes EMISSINGARG)
npm install --save
npm install -g
npm install --save-dev

If you just want to install dependencies from package.json, use npm install without any flags.

2Check and upgrade your npm version

Check your current npm version and upgrade if it's outdated:

bash
# Check current version
npm --version

# Upgrade npm to the latest stable version
npm install -g npm@latest

# After upgrading, clear your shell's command cache
hash -r

# Verify the upgrade worked
npm --version

Aim for npm 5.0 or higher. If you're on npm 3.x, upgrading is critical.

3Use Node Version Manager (nvm) for clean updates

Instead of using system package managers, use nvm to install Node.js and npm cleanly:

bash
# Install nvm (macOS/Linux)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# Reload your shell configuration
source ~/.bashrc  # or ~/.zshrc for macOS

# Install the latest LTS Node.js (includes modern npm)
nvm install --lts

# Verify installation
node --version && npm --version
4Clean npm cache if upgrading doesn't work

If the error persists after upgrading npm, try clearing the npm cache:

bash
# Clear the npm cache
npm cache clean --force

# Delete node_modules and package-lock.json
rm -rf node_modules package-lock.json

# Reinstall all dependencies
npm install

# If installing a specific package, now try with correct syntax
npm install express --save
5Check and fix .npmrc configuration

Invalid npm configuration can also cause this error. Check your .npmrc files:

bash
# Check global npm config
cat ~/.npmrc

# Check project-level config
cat .npmrc

# Check npm configuration
npm config list

If you find deprecated or invalid settings, remove them or update them:

bash
# Reset to defaults if needed
npm config set registry https://registry.npmjs.org/
6Verify in a fresh directory as a final test

Create a test directory to isolate the issue:

bash
# Create a temporary test directory
mkdir -p ~/npm-test
cd ~/npm-test

# Initialize a new npm project
npm init -y

# Try installing a common package
npm install lodash

# Check that package.json was updated
cat package.json

If these commands work, the issue was project-specific. If they still fail, you have a system-wide npm issue.

Advanced notes

The EMISSINGARG error is particularly common in npm versions 3.5.x through 3.10.x due to a bug in npm's argument parser when resolving dependencies. While this was fixed in npm 3.10.8+, many CI/CD systems and older Docker containers still use these versions. If you control the Node.js installation (Docker, CI pipeline), explicitly specify a modern Node.js version (14.x, 16.x, 18.x, or later) which includes npm 6.x or higher. In Ubuntu/Debian systems, avoid apt install nodejs as it often installs very outdated versions; use the NodeSource repository or nvm instead.

Frequently asked questions

What does "EMISSINGARG" mean?
This error occurs when npm expects a package name argument but none was provided. The EMISSINGARG error code indicates a missing required argument #1, which is typically the package name. In most cases, developers have used npm install with a flag like --save, -g, or --save-dev but forgot to specify which package to install.
How do I fix "EMISSINGARG"?
This EMISSINGARG error occurs when npm expects a package name argument but none was provided. Include the package name when using installation flags like --save or -g.
What causes "EMISSINGARG"?
Forgot to specify a package name when using installation flags (--save, -g, --save-dev, --save-optional) Using an outdated version of npm (versions 3.5.x to 3.10.x are known to have this issue) Corrupted or outdated Node.js version installed via system package manager rather than nvm
Is the "EMISSINGARG" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading