Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ETARGET No matching version found after version update; cache clear helps #7604

Closed
2 tasks done
mo22 opened this issue Jun 20, 2024 · 6 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Cannot Reproduce

Comments

@mo22
Copy link

mo22 commented Jun 20, 2024

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm --version: 10.8.1
node --version: v22.3.0
mac intel 14.5

when updating to newer versions of packages:

npm install @radix-ui/[email protected]

the result is:

npm error code ETARGET
npm error notarget No matching version found for @radix-ui/[email protected].
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.

npm log:

15 silly fetch manifest @radix-ui/[email protected]
16 silly packumentCache full:https://registry.npmjs.org/@radix-ui%2freact-accordion cache-miss
17 http fetch GET 200 https://registry.npmjs.org/@radix-ui%2freact-accordion 213ms (cache stale)
18 silly packumentCache full:https://registry.npmjs.org/@radix-ui%2freact-accordion set size:506624 disposed:false
[...]
91 silly placeDep ROOT @radix-ui/react-accordion@ REPLACE for: [email protected] want: 1.2.0
[...]
127 verbose stack @radix-ui/react-accordion: No matching version found for @radix-ui/[email protected].

after running npm cache clear --force the command runs through fine.

Expected Behavior

npm command succeeding without cache clear

Steps To Reproduce

npm init
npm install some-package
# wait for some-package to be updated
npm install some-package@new-version

Environment

npm --version: 10.8.1
node --version: v22.3.0
mac intel 14.5

npm config:

//registry.npmjs.org/:_authToken = (protected)
legacy-peer-deps = false
prefer-offline = true
prefix = "/usr/local"
@mo22 mo22 added Bug thing that needs fixing Needs Triage needs review for next steps labels Jun 20, 2024
@mo22
Copy link
Author

mo22 commented Jun 20, 2024

I will check if that is caused by prefer-offline = true. Still it should fall back to online in that case.

@milaninfy
Copy link
Contributor

milaninfy commented Jun 20, 2024

@mo22 works fine for me. Is it happening for any packages or just this specific one ?

~/workarea/rep/temp $ npm install @radix-ui/[email protected] --prefer-offline

added 21 packages, and audited 22 packages in 3s

found 0 vulnerabilities
~/workarea/rep/temp $ npm install @radix-ui/[email protected] --prefer-offline

removed 2 packages, changed 14 packages, and audited 20 packages in 1s

found 0 vulnerabilities

@mo22
Copy link
Author

mo22 commented Jun 20, 2024

@milaninfy it happens to all packages; if the version is not yet released at the time of install (independent of the version to be installed) and later upgraded it happens to me, often when I run npm-check -u in a project.

Strangely I have tested it right now with an npm package published by me - clear npm cache, install version, release newer version and run npm-check -u and upgrade the package, worked without issues right now.

I will investigate further

@milaninfy milaninfy added Cannot Reproduce and removed Needs Triage needs review for next steps labels Jun 20, 2024
@mo22
Copy link
Author

mo22 commented Jun 21, 2024

I can confirm that it only happens if I have prefer-offline=true in my .npmrc file or use the --prefer-offline flag.

I believe that setting causes npm-registry-fetch/lib/index.js to use force-cache when retrieving https://registry.npmjs.org/package-name, which in turn uses the offline cached version of it, which is of course not the new version.

So npm install [email protected] will see the cached state wich does not include version 10.0.0.

@milaninfy
Copy link
Contributor

@mo22 then it's not an issue, if the cache is already there and you are using --prefer-offline flag then it would use from cache if available and would be unaware of latest publish/version.

@mo22 mo22 closed this as completed Jun 27, 2024
@mo22
Copy link
Author

mo22 commented Jun 27, 2024

I assume you are right.
In theory that means you will not be able to update packages to versions that are released after the package info has been retrieved and cached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Cannot Reproduce
Projects
None yet
Development

No branches or pull requests

2 participants