The ENOTARGET error occurs when npm cannot find a version of a package matching your requirements. This usually means the version doesn't exist or has been unpublished.
Fixes npm ERR! code ENOTARGET
npm view package-name versions
# See dist-tags
npm view package-name dist-tagsnpm view package-name versions# See dist-tagsnpm view package-name dist-tagsnpm ERR! code ENOTARGET
ENOTARGET means npm searched the registry for a package version matching your specification but found nothing. This can happen with exact versions that don't exist, ranges that exclude all published versions, or packages that have been unpublished. Remember that npm packages can be unpublished within 24 hours of publishing (or 72 hours if no dependents). After that, they're permanent.
List all published versions:
npm view package-name versions
# See dist-tags
npm view package-name dist-tagsCheck your package.json:
# See what you're requesting
npm pkg get dependencies.package-name
# Compare with available
npm view package-name versionUpdate to an existing version:
# Install latest
npm install package-name@latest
# Or specific existing version
npm install [email protected]Adjust your range:
// Maybe too specific
"dep": "1.2.3" // Exact version
// More flexible
"dep": "^1.2.0" // Compatible versions
"dep": ">=1.0.0" // MinimumPrerelease needs explicit tag:
# See all versions including prereleases
npm view package-name versions --json
# Install prerelease explicitly
npm install package-name@next
npm install [email protected]Ensure correct registry:
# Check current registry
npm config get registry
# Reset to default
npm config set registry https://registry.npmjs.orgUnpublished packages leave a gap - the version number cannot be reused. For critical dependencies, consider vendoring or using a private registry mirror. Use package-lock.json to ensure version consistency. If a package disappears, check for forks or alternatives. The npm registry API shows detailed package metadata.