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.
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.
First, check that you're providing a package name when using installation flags:
# 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-devIf you just want to install dependencies from package.json, use npm install without any flags.
Check your current npm version and upgrade if it's outdated:
# 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 --versionAim for npm 5.0 or higher. If you're on npm 3.x, upgrading is critical.
Instead of using system package managers, use nvm to install Node.js and npm cleanly:
# 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 --versionIf the error persists after upgrading npm, try clearing the npm cache:
# 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 --saveInvalid npm configuration can also cause this error. Check your .npmrc files:
# Check global npm config
cat ~/.npmrc
# Check project-level config
cat .npmrc
# Check npm configuration
npm config listIf you find deprecated or invalid settings, remove them or update them:
# Reset to defaults if needed
npm config set registry https://registry.npmjs.org/Create a test directory to isolate the issue:
# 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.jsonIf these commands work, the issue was project-specific. If they still fail, you have a system-wide npm issue.
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.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error