How to fix npm ERR! code EMISSINGARG npm ERR! Missing required argument in npm
EMISSINGARG occurs when npm is unable to properly parse command arguments, typically due to using an outdated npm version or missing required parameters. Update npm and verify your command syntax.
Quick fix
Fixes EMISSINGARG
npm --version
node --version- Check your current npm and Node.js versions
- Clear the npm cache
- Upgrade npm to the latest version
- Upgrade Node.js to a current LTS version
npm --versionnode --versionnpm ERR! code EMISSINGARGnpm ERR! Missing required argument
What this error means
The 'npm ERR! code EMISSINGARG' error occurs when npm is unable to properly parse command arguments, typically due to using an outdated version of npm (especially npm v3.x) that cannot handle modern package structures and dependencies. This error indicates that a required argument is missing from an npm command, or that npm's internal argument parsing has failed. The error commonly occurs during 'npm install', 'npm update', or 'npm uninstall' operations when the npm version on your system is no longer compatible with current packages in the npm registry.
Typical symptoms
- npm install fails with 'TypeError Error: Missing required argument #1' (or #2, #3)
- npm update -g produces EMISSINGARG errors even though the command appears correct
- npm uninstall package-name fails with missing argument errors despite proper syntax
- Error originated from fetch-package-metadata.js or similar internal npm files
- npm commands that previously worked suddenly fail after updating package.json
Common causes
- Using an outdated version of npm (particularly npm v3.x series) that has bugs in argument parsing
- Node.js version is outdated and doesn't include a compatible npm version
- npm installed via apt-get or system package manager on Linux/Ubuntu rather than via NodeSource or nvm
- Corrupted or incompatible npm cache preventing proper package metadata parsing
- npm configuration in .npmrc file has invalid syntax or deprecated settings
- Using older npm flags or options that are no longer supported in modern npm versions
How to fix "npm ERR! code EMISSINGARG npm ERR! Missing required argument"
First, verify which versions you're running:
npm --version
node --versionIf npm is version 3.x or Node.js is below v10.x, you have outdated software. Modern development requires at least npm v6+ and Node.js v14+.
Before upgrading, clear your npm cache to remove any corrupted metadata:
npm cache clean --forceThis removes cached package data that may be causing parsing issues.
Update npm to the current version (v8+ or v9+):
npm install -g npm@latestIf that doesn't work with your outdated npm, try:
sudo npm i -g npmAfter upgrading on Linux/macOS, refresh your shell to recognize the new npm location:
hash -rIf npm upgrade alone doesn't solve it, upgrade Node.js:
Using Node Version Manager (nvm) - recommended:
nvm install --lts
nvm use --ltsOn Linux (using NodeSource repository):
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejsAfter upgrading, verify:
node --version
npm --versionAfter upgrading npm and Node.js, remove cached dependencies and reinstall:
rm -rf node_modules package-lock.json
npm installOn Windows (PowerShell):
Remove-Item -Recurse -Force node_modules
Remove-Item package-lock.json
npm installDouble-check that your npm commands follow the correct syntax:
Correct examples:
npm install # Install all dependencies
npm install express # Install a specific package
npm uninstall express # Remove a package
npm install --save-dev mocha # Install as dev dependencyIncorrect examples that trigger this error:
npm install --save-dev # Missing package name
npm uninstall # Missing package nameAdvanced notes
The EMISSINGARG error is fundamentally a version compatibility issue. npm v3.x had bugs in the fetch-package-metadata.js module that prevented it from properly parsing modern package structures. These bugs were fixed in npm v6+. If you're in a Docker container or CI/CD environment, ensure your base image uses a modern Node.js version - for example, use 'FROM node:20-alpine' rather than 'FROM node:8'. On Linux systems using apt-get installed Node.js, the package manager repositories are notoriously behind; use NodeSource repositories or nvm instead.
Frequently asked questions
- What does "EMISSINGARG" mean?
- The 'npm ERR! x) that cannot handle modern package structures and dependencies. This error indicates that a required argument is missing from an npm command, or that npm's internal argument parsing has failed.
- How do I fix "EMISSINGARG"?
- EMISSINGARG occurs when npm is unable to properly parse command arguments, typically due to using an outdated npm version or missing required parameters. Update npm and verify your command syntax.
- What causes "EMISSINGARG"?
- Using an outdated version of npm (particularly npm v3.x series) that has bugs in argument parsing Node.js version is outdated and doesn't include a compatible npm version npm installed via apt-get or system package manager on Linux/Ubuntu rather than via NodeSource or nvm
- Is the "EMISSINGARG" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐npm Official Documentation
- ๐Docs: EMISSINGARG Error(Official Docs)
- ๐ฌSO: npm error troubleshooting(Stack Overflow)
- ๐GitHub: npm issues(GitHub)