AI Diagnostic Summary

npm ERR! code ETARGET

Well-Documented Error

This error matches known, documented patterns with reliable solutions.

Quick Fix (Most Common Solution)

Seeing "npm ERR! code ETARGET"? This error can be frustrating, but it's usually fixable. It typically affects your development workflow or system. Below you'll find clear, step-by-step solutions to resolve this issue.

High confidence
What This Error Means

npm cannot find a package version that matches your version constraints.

Frequently documented in developer and vendor support forums.

Based on documented solutions and common real-world fixes.
Not affiliated with browser, OS, or device manufacturers.

New here? Learn why exact error messages matter →

Common Causes
  • Version range too restrictive
  • Package version does not exist
  • Outdated package.json requirements
How to Fix
  1. Check available versions with npm view package versions
  2. Update version range in package.json
  3. Use latest stable version

Last reviewed: March 2026 How we review solutions

Why This Happens

ETARGET means npm queried the registry for a package and found it exists, but no published version satisfies the version range specified in your package.json or package-lock.json. This is different from E404 (package not found)—ETARGET means the package exists but the specific version you want does not. The most common cause is a typo in the version range: specifying "^99.0.0" or "~5.0.0" when the latest published version is 4.x. Another frequent trigger is a lockfile that references an unpublished version—npm authors occasionally unpublish pre-release or broken versions, leaving lockfile entries pointing to versions that no longer exist. Dependency resolution conflicts can also produce ETARGET: if package A requires "lodash@^4.17.0" and package B requires "lodash@^5.0.0" but lodash 5 does not exist yet, npm cannot satisfy both constraints. Corporate registry proxies that are not fully synced with the public registry may return a subset of available versions, causing ETARGET for versions that exist publicly but have not been cached by the proxy yet.

Quick Diagnostic Checklist
  1. Check available versions: npm view package-name versions
  2. Compare the requested version range with available versions
  3. Delete package-lock.json and run npm install to regenerate
  4. Check for typos in the version range in package.json
  5. If using a proxy registry, verify it has the latest versions cached
Fixing ETARGET version mismatch
# Error output:
# npm ERR! code ETARGET
# npm ERR! notarget No matching version found for react@^19.0.0
# npm ERR! notarget In most cases you or one of your dependencies
# npm ERR! notarget are requesting a package version that doesn't exist.

# Step 1: Check what versions are available
$ npm view react versions --json | tail -10
# "18.2.0", "18.3.0", "18.3.1"   <-- Latest is 18.3.1, no 19.x

# Step 2: Check what your package.json specifies
$ grep react package.json
# "react": "^19.0.0"   <-- Requesting >=19.0.0 but it doesn't exist

# Step 3: Fix the version range
# In package.json, change "^19.0.0" to "^18.3.0"
$ npm install

# Step 4: If lockfile is stale, regenerate
$ rm package-lock.json
$ npm install   # Fresh resolution with correct versions

# Step 5: Check if a dependency forces the bad version
$ npm ls react
# Shows which package requires the non-existent version

# Step 6: If using a pre-release version
$ npm install react@next   # Install the latest pre-release
$ npm install react@canary # Install the canary build
Edge Cases & Unusual Scenarios

Unpublished pre-release version in lockfile

Package authors sometimes publish and then unpublish alpha or beta versions. If your lockfile references an unpublished version, delete package-lock.json and run npm install to resolve to an available version.

Dist-tag pointing to non-existent version

npm packages can have custom dist-tags (like next, canary, beta). If the tag was updated or removed, npm install package@tag may return ETARGET. Check available tags with npm dist-tag ls package-name.

Verdaccio proxy with incomplete version cache

Verdaccio caches package metadata on first request. If the cache is old, newer versions are not listed. Access the Verdaccio admin panel and clear the cache for the affected package, or bump the cache TTL configuration.

Optional follow-up

Some users ask whether saving fixes for recurring errors would be useful when the same issue appears again.

Was this explanation helpful?

Explanations are based on documented fixes, real-world reports, and common system behavior. GetErrorHelp is independent and not affiliated with software vendors, device manufacturers, or service providers.
Frequently Asked Questions

How do I see all package versions?

Run npm view package-name versions to list all published versions.

What version syntax should I use?

Use ^1.0.0 for compatible updates or ~1.0.0 for patch updates only.

How do I find the latest version of a package?

Run npm view package-name version for the latest stable version, or npm view package-name versions for all published versions. You can also check the package page on npmjs.com for the full version history.

What does the caret (^) in version ranges mean?

The caret allows updates that do not modify the leftmost non-zero digit. ^1.2.3 means >=1.2.3 <2.0.0. ^0.2.3 means >=0.2.3 <0.3.0. If the specified major version does not exist, npm returns ETARGET.

Can I install a specific commit or branch instead of a version?

Yes. Use npm install user/repo#branch or npm install user/repo#commit-sha to install directly from Git. This bypasses version resolution entirely and is useful when you need a fix that has not been published yet.

Related Resources

Also Known As

Common Search Variations

Related Errors
Still Stuck?

Paste a different error message or upload a screenshot to get help instantly.

Solutions are based on commonly documented fixes and may not apply in all situations.