npm ETARGET "No matching version found": What It Means and How to Fix It
npm error code ETARGET, No matching version found, means your registry has no such version. Check typos, unpublished versions, .npmrc scopes and cache.
npm error code ETARGET with No matching version found for <package>@<version> means npm looked up the package on the registry it's configured to use and none of the published versions match what you asked for. The quickest check is npm view <package> versions: if your version isn't in that list, fix the version in package.json. If it is in the list, the problem is your registry config, a stale cache, or a version so new your machine hasn't seen it yet.
What the error looks like
npm error code ETARGET
npm error notarget No matching version found for react-widget@3.4.7.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.
Two things to note:
- The package and version after "No matching version found for". That's what npm tried to resolve.
- "you or one of your dependencies". The request might not come from your own
package.json. A dependency can ask for a version of something that doesn't exist.
Step 1: see which versions actually exist
npm view react-widget versions
npm view react-widget dist-tags
The first lists every published version. The second shows tags like latest, next or beta and which version each points to. Both come from the npm view docs.
Compare the list with what you asked for. That usually points straight at one of the causes below.
Cause 1: a typo or a version that never existed
The most common case. Typical mistakes:
- A digit off:
3.4.7when the latest is3.4.6. - A major version that hasn't been released:
"next": "^17.0.0"when the newest is 16.x. - A tag that doesn't exist:
npm install some-lib@betawhen the package only haslatest. - Copying a version from a blog post, changelog or AI suggestion that was wrong or referred to a different package.
AI coding tools are especially prone to the last one: they sometimes write a plausible-looking version number that was never published, or a package name that doesn't exist at all. Our post on AI hallucinated packages covers why and how to check.
Fix: change the version in package.json to one from the npm view list, or install a real version directly:
npm install react-widget@3.4.6
Use a range like ^3.4.6 if you want compatible updates later (see semantic versioning explained).
Cause 2: the version was unpublished
A version that existed last month can disappear. npm's unpublish policy lets authors remove a version within 72 hours of publishing, and in some limited cases later. When that happens, any lockfile or package.json that pins the removed version gets ETARGET.
The same policy says a package@version can never be reused, so the author can't put a different file back under the same number. You'll need to move to another version from the list.
Deprecated is different. A deprecated version is still downloadable. npm prints a deprecation warning, but you won't get ETARGET for it. If you see both a deprecation warning and ETARGET, they're about different things.
Cause 3: wrong registry, or a scope pointing at the wrong place
npm asks one registry for each package. If that registry doesn't have the version, you get ETARGET even when the public npm registry does (or the other way round). Check what you're using:
npm config get registry
npm config list
npm config list shows settings from your project .npmrc, your user ~/.npmrc and global config, so you can spot where an unexpected value came from.
Common situations:
A company mirror (Artifactory, Nexus, Verdaccio) that hasn't synced a new version yet, or only allows approved versions.
A scoped package from a private registry. Packages like
@mycompany/uiare often hosted on GitHub Packages or an internal registry. The scope needs its own registry line in.npmrc, for example:@mycompany:registry=https://npm.pkg.github.comThe npm scope docs show setting this with
npm config set @mycompany:registry=<url>. Without it, npm looks for@mycompany/uion the public registry, where your private versions don't exist.The reverse: a scope mapped to a private registry that doesn't mirror public packages under that scope.
To check against a specific registry directly:
npm view react-widget versions --registry=https://registry.npmjs.org/
If the version shows up there but not with your normal config, the registry setup is the problem.
Cause 4: a stale cache or a brand-new release
You or a teammate just published 3.5.0, it shows on npmjs.com, and npm install react-widget@3.5.0 still says no matching version. npm keeps package metadata in its local cache and may use a cached copy that predates the release. Mirrors and CDNs in between can also lag for a short while.
Ask npm to check the registry for fresh metadata:
npm install react-widget@3.5.0 --prefer-online
The npm config docs describe prefer-online as forcing staleness checks for cached data. Also make sure you don't have prefer-offline=true in an .npmrc, which tells npm to skip those checks.
If it still fails, wait a few minutes and try again, and confirm with npm view react-widget versions --prefer-online that the version is listed.
Cause 5: a before date in your config
If your config sets before (a date), npm only considers versions published before that date. The error then reads No matching version found for react-widget@3.5.0 with a date before .... Remove or update the setting if that's not what you intended.
When a dependency is asking for the missing version
If the version in the error isn't in your package.json, find who requested it:
grep -n '"react-widget"' package-lock.json
The surrounding entries show which package depends on it. Usually a newer version of that parent package has fixed the requirement, so updating the parent is the cleanest fix. If not, you can force a real version for the whole tree with overrides in package.json:
"overrides": {
"react-widget": "3.4.6"
}
Test afterwards, because the parent package hasn't been tested with that exact version. The npm ERESOLVE guide covers overrides in more detail.
Summary
- ETARGET means no published version on your configured registry matches the request.
- Run
npm view <pkg> versionsandnpm view <pkg> dist-tagsfirst. - Not in the list: fix the typo or pick a real version (unpublished versions can't come back).
- In the list: check
npm config get registry, your scope lines in.npmrc, and retry with--prefer-online. - If a dependency asked for it, update the parent package or use
overrides.
For the bigger picture on how npm resolves versions, see npm and package.json explained.
EasySpawn runs Claude Code on a persistent cloud server where it can run npm install and check the result itself, so a made-up version number gets caught before it reaches your deploy. See how it works or join the waitlist.
Related: AI Hallucinated a Package: Fake Libraries, Made-Up APIs, and Slopsquatting · Semantic Versioning Explained: What 2.4.1 Actually Means · npm ERESOLVE "Unable to Resolve Dependency Tree": What It Means and How to Fix It · What Are npm and package.json? A Beginner's Guide
Keep reading
npm EBADENGINE "Unsupported engine": What It Means and How to Fix It
npm warn EBADENGINE Unsupported engine means a package wants another Node version. When to ignore it, what engine-strict does, and how to switch Node.
Git "error: object file is empty": How to Recover a Corrupted Repository
Git error object file is empty or loose object is corrupt after a crash or full disk? Back up .git, delete empty objects, re-fetch, and check with git fsck.