The "Missing name" error occurs when your package.json lacks the required "name" field. The name is mandatory for npm to identify and work with your package.
The name field is one of only two required fields in package.json (along with version). It identifies your package and is used for installation, publishing, and referencing. Without a name, npm cannot identify your package, cannot install it from the registry, and cannot distinguish it from other packages.
Include name in package.json:
{
"name": "your-package-name",
"version": "1.0.0"
}Both name and version are required.
Let npm create valid package.json:
# Interactive
npm init
# Quick with defaults
npm init -yThis ensures all required fields exist.
The name might exist but be unparseable:
# Validate JSON
node -e "console.log(JSON.parse(require('fs').readFileSync('package.json')))"
# Pretty print to check
cat package.json | npx jsonIf accidentally deleted:
# See what changed
git diff package.json
# Restore
git checkout HEAD -- package.jsonIf name was lost in merge:
# Check for conflict markers
grep -n "<<<<<<" package.json
# Manually resolve or:
git checkout --theirs package.json
# Then verify and re-add your changesName selection tips:
- Descriptive but concise
- Lowercase with hyphens
- Check availability: npm view desired-name
- Consider scope for org: @myorg/package
For private packages not published to npm, name is still required but doesn't need to be unique. Private packages typically use scopes (@company/package). In monorepos, each package needs its own name. Workspaces reference packages by name, so consistency matters.
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