yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.43k stars 2.72k forks source link

yarn install: Couldn't find package "package-name" on the "npm" registry #6029

Closed roytz closed 6 years ago

roytz commented 6 years ago

Please do not close this issue as duplicate - it's not the same as #3645 or #2611

Do you want to request a feature or report a bug? Bug

What is the current behavior? Whenever executing yarn install I get an error message - Couldn't find package "[PACKAGE_NAME]" on the "npm" registry. After removing the PACKAGE_NAME line from the package.json dependencies, I get the same error for the next package on the list. I use yarn workspaces but the errors I get are for regular packages (such as winston, eslint etc.). Even after removing workspaces it still happens.

What is the expected behavior? Install all packages with no errors.

Please mention your node.js, yarn and operating system version. yarn: 1.7.0 node: 10.5.0 OS: macOS Sierra

hulkish commented 6 years ago

@roytz are u by chance having any network issues (Firewall, etc)? Or, do you have a different registry set for any of your .yarnrc or .npmrc files?

Can you run the same command and include the --verbose flag, then post the log here?

roytz commented 6 years ago

@hulkish thank you!!! I wasn't aware that the configuration file might cause the problem. I wasted so much time on that... Thanks again!

aleclarson commented 5 years ago

I'm facing this issue. Here is the verbose output:

yarn install v1.12.3
verbose 0.438 Checking for configuration file "~/lib/modules/immer/.npmrc".
verbose 0.438 Found configuration file "~/lib/modules/immer/.npmrc".
verbose 0.439 Checking for configuration file "~/.npmrc".
verbose 0.439 Found configuration file "~/.npmrc".
verbose 0.439 Checking for configuration file "~/.nvm/versions/node/v11.1.0/etc/npmrc".
verbose 0.44 Checking for configuration file "~/lib/modules/immer/.npmrc".
verbose 0.44 Found configuration file "~/lib/modules/immer/.npmrc".
verbose 0.44 Checking for configuration file "~/lib/modules/.npmrc".
verbose 0.44 Checking for configuration file "~/lib/.npmrc".
verbose 0.441 Checking for configuration file "~/.npmrc".
verbose 0.441 Found configuration file "~/.npmrc".
verbose 0.442 Checking for configuration file "/Users/.npmrc".
verbose 0.444 Checking for configuration file "~/lib/modules/immer/.yarnrc".
verbose 0.445 Checking for configuration file "~/.yarnrc".
verbose 0.445 Found configuration file "~/.yarnrc".
verbose 0.445 Checking for configuration file "~/.nvm/versions/node/v11.1.0/etc/yarnrc".
verbose 0.446 Checking for configuration file "~/lib/modules/immer/.yarnrc".
verbose 0.446 Checking for configuration file "~/lib/modules/.yarnrc".
verbose 0.446 Checking for configuration file "~/lib/.yarnrc".
verbose 0.446 Checking for configuration file "~/.yarnrc".
verbose 0.446 Found configuration file "~/.yarnrc".
verbose 0.447 Checking for configuration file "/Users/.yarnrc".
verbose 0.451 current time: 2018-11-28T15:15:05.417Z
info No lockfile found.
[1/4] 🔍  Resolving packages...
verbose 0.525 Performing "GET" request to "https://registry.yarnpkg.com/@types%2fjest".
verbose 0.682 Request "https://registry.yarnpkg.com/@types%2fjest" finished with status code 401.
verbose 0.695 Error: Couldn't find package "@types/jest" on the "npm" registry.
    at MessageError.ExtendableBuiltin (~/.nvm/versions/node/v11.1.0/pnpm-global/1/node_modules/.registry.npmjs.org/yarn/1.12.3/node_modules/yarn/lib/cli.js:727:66)
    at new MessageError (~/.nvm/versions/node/v11.1.0/pnpm-global/1/node_modules/.registry.npmjs.org/yarn/1.12.3/node_modules/yarn/lib/cli.js:756:123)
    at NpmResolver.<anonymous> (~/.nvm/versions/node/v11.1.0/pnpm-global/1/node_modules/.registry.npmjs.org/yarn/1.12.3/node_modules/yarn/lib/cli.js:49829:15)
    at Generator.next (<anonymous>)
    at step (~/.nvm/versions/node/v11.1.0/pnpm-global/1/node_modules/.registry.npmjs.org/yarn/1.12.3/node_modules/yarn/lib/cli.js:304:30)
    at ~/.nvm/versions/node/v11.1.0/pnpm-global/1/node_modules/.registry.npmjs.org/yarn/1.12.3/node_modules/yarn/lib/cli.js:315:13
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
error Couldn't find package "@types/jest" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Nothing in the found .npmrc and .yarnrc files looks suspicious.

I can visit the URL that responded with status code 401, and there doesn't seem to an issue there.

Installing with npm install @types/jest -D works fine.

Attempted solutions

 

Versions

aleclarson commented 5 years ago

Using yarn --registry https://registry.npmjs.org worked.

edit: Using yarn --registry https://registry.yarnpkg.com fails with the same error as my previous comment.

Hmm..

alvincrespo commented 5 years ago

Moving my .npmrc file to my desktop temporarily worked for me.

I was trying to install @pusher/chatkit-client and the error above was being given to me. This is after 2 years of not having done anything to my .npmrc. The contents of that file were:

//registry.npmjs.org/:_authToken=SOME_AUTH_TOKEN
init.author.name=MY_NAME

Not sure what the issue was.

j-walker23 commented 5 years ago

I just randomly had the exact same issue as @alvincrespo and clearing the random line out of .npmrc fixed it for me. Lol, most random issue ever.

giltotherescue commented 5 years ago

I was able to solve this error by running npm login and logging in again.

nshoes commented 5 years ago

Ran into this issue a few minutes ago. Can confirm that it was my .npmrc. I renamed it and everything works now. Wonder what's going on? I haven't touched that file for more than a year.

cameron-martin commented 5 years ago

I've started getting these errors too. When I removed the line from my .npmrc file with an auth token for the main npm registry that looked like a UUID (separated by dashes), then it worked.

What's strange is that the other auth tokens were not of this format - they look as if they are some base64-encoded string.

aleclarson commented 5 years ago

The //registry.npmjs.org/:_authToken= part is generated by npm login. See here

What's weird is that npm install works fine, while yarn chokes.

edit: More accurately, https://registry.yarnpkg.com is the one choking, since doing..

yarn --registry https://registry.npmjs.org

..also works as expected.

nshoes commented 5 years ago

@aleclarson note that yarn --registry https://registry.npmjs.org did not solve the issue for me.

eurycea commented 5 years ago

seems related to #6727 and https://blog.npmjs.org/post/180599338975/401-scoped-packages?_ga=2.184952618.246059681.1543444959-2036018327.1543444959

cameron-martin commented 5 years ago

@eurycea that blog post fully explains it for my case

hulkish commented 5 years ago

considering i can see this error with and without a npmrc....and, when i do have one its pointed to a private registry... i highly doubt that this is the cause.

Adnan-Toky commented 5 years ago

Thanks @aleclarson yarn --registry https://registry.npmjs.org also worked for me..

seeliang commented 4 years ago

My experience is slightly different and it may help others

I had updated ~/.npmrc to team domain and team domain only,

so it was missing https://registry.npmjs.org

if we put it back, it will work

eaorak commented 4 years ago

In my case, it was because of ~/.npmrc file which defines another registry (used for enterprise environment and not accessible anymore). When I removed that configuration it worked fine.

raphaelsoul commented 4 years ago

in my case, it is totally new project and i am trying to install webpack. which gives me

$ yarn add webpack webpack-cli -DE
yarn add v1.15.2
info No lockfile found.
[1/4] 🔍  Resolving packages...
error Couldn't find package "p-is-promise@^2.0.0" required by "mem@^4.0.0" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

MacOS Catalina node:8 yarn 1.15.2

Trying to upgrade yarn to latest to check if happens again

pflugs30 commented 4 years ago

I encountered this situation today. I resolved it by simply using the Yarn cache: yarn --prefer-offline

evheniy commented 4 years ago

The same problem today: error Couldn't find package "2-thenable@^1.0.0" required by "stream-promise@^3.2.0" on the "npm" registry.

"npm i" works, but "yarn" - doesn't work

elgordino commented 4 years ago

I have the same problem with 2-thenable trying to install serverless. It is missing from https://registry.yarnpkg.com. I tried to search some way to report these issues but couldn't find it so adding to this thread.

Relevant output from --verbose

verbose 1.176 Performing "GET" request to "https://registry.yarnpkg.com/2-thenable".
verbose 1.218 Request "https://registry.yarnpkg.com/2-thenable" finished with status code 404.
verbose 1.403 Error: Couldn't find package "2-thenable@^1.0.0" required by "stream-promise@^3.2.0" on the "npm" registry.

I assume yarnpkg caches 404's for a period but this has now been happening for about 12 hours.

jacobq commented 4 years ago

I have the same problem with 2-thenable trying to install serverless....

I wonder if the problem that suddenly appeared today is related to package names starting with a numeral. This started happening to me this morning with the package 3d-view (published years ago). Requesting via web browser works as does npm install. No .npmrc or .yarnrc files present in project. Tried npm login to no avail. Tried --registry https://registry.npmjs.org without improvement. Using --prefer-offline works around the problem for now but only since the package happens to be cached on my machine from a previous time.

I am hoping that this is a transient problem related to yarn infrastructure or something and will just go away soon....

Version info yarn version: 1.21.1 OS: Linux x64 node version: v12.14.1 npm version: 6.13.4
Output ``` verbose 2.978862289 Performing "GET" request to "https://registry.npmjs.org/3d-view". verbose 3.028520022 Request "https://registry.npmjs.org/3d-view" finished with status code 404. verbose 3.035182478 Error: https://registry.npmjs.org/3d-view: Not found at Request.params.callback [as _callback] (/usr/share/yarn/lib/cli.js:66947:18) at Request.self.callback (/usr/share/yarn/lib/cli.js:140665:22) at Request.emit (events.js:223:5) at Request. (/usr/share/yarn/lib/cli.js:141637:10) at Request.emit (events.js:223:5) at IncomingMessage. (/usr/share/yarn/lib/cli.js:141559:12) at Object.onceWrapper (events.js:312:28) at IncomingMessage.emit (events.js:228:7) at endReadableNT (_stream_readable.js:1185:12) at processTicksAndRejections (internal/process/task_queues.js:81:21) error An unexpected error occurred: "https://registry.npmjs.org/3d-view: Not found". ```
yovanoc commented 4 years ago

Same problem for me with this

error Couldn't find package "7zip-bin@~5.0.3" required by "builder-util@22.3.2" on the "npm" registry. so with a number first too like @jacobq

pflugs30 commented 4 years ago

I think we've documented all we need on this thread. It seems that several other issues are being opened for this bug:

nitishr12 commented 4 years ago

Check if you have an other .npmrc or .yarnrc defined in your root folders or other folders. 'yarn install' might override the project configs to use the other config. It worked for me when I cleared out other .npmrc/.yarnrc files.

InsOpDe commented 4 years ago

I am using a nexus private repository and saw in the debug logs that yarn tries to download

https://nexus.example.com/repository/npm-group/@paralleldrive%2freact-feature-toggles

with which the nexus responds with 404, because it should be

https://nexus.example.com/repository/npm-group/@paralleldrive/react-feature-toggles

i.e. the slash which gets url-encoded is the problem. id say that this is a problem with nexus not properly handling urls, but is it possible to turn yarns url-encoding off?

edit: This problem is known and a solution is documented here: https://issues.sonatype.org/browse/NEXUS-19709

samuelcastro commented 4 years ago

I am facing the same issue.

rituriteshritz commented 4 years ago

Here is the --verbose log

PS C:\supportserviceUI2\support-service-ui> yarn --verbose yarn install v1.19.2 verbose 0.4009734 Checking for configuration file "C:\supportserviceUI2\support-service-ui\.npmrc". verbose 0.403072 Found configuration file "C:\supportserviceUI2\support-service-ui\.npmrc". verbose 0.404912799 Checking for configuration file "C:\Users\r.sanjay.chaudhari\.npmrc". verbose 0.4064841 Checking for configuration file "C:\Program Files\nodejs\etc\npmrc". verbose 0.4078404 Checking for configuration file "C:\supportserviceUI2\support-service-ui\.npmrc". verbose 0.4089847 Found configuration file "C:\supportserviceUI2\support-service-ui\.npmrc". verbose 0.4105523 Checking for configuration file "C:\supportserviceUI2\.npmrc". verbose 0.4179336 Checking for configuration file "C:\supportserviceUI2\support-service-ui\.yarnrc". verbose 0.43528 Checking for configuration file "C:\Users\r.sanjay.chaudhari\.yarnrc". verbose 0.438289299 Found configuration file "C:\Users\r.sanjay.chaudhari\.yarnrc". verbose 0.4439843 Checking for configuration file "C:\Program Files\nodejs\etc\yarnrc". verbose 0.4641203 Checking for configuration file "C:\supportserviceUI2\support-service-ui\.yarnrc". verbose 0.483050699 Checking for configuration file "C:\supportserviceUI2\.yarnrc". verbose 0.509881299 current time: 2020-07-31T13:01:26.161Z verbose 0.747530899 Performing "GET" request to "https://yarnpkg.com/latest-version". warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... warning Resolution field "nodemon@1.18.7" is incompatible with requested version "nodemon@^2.0.2" warning Resolution field "mkdirp@0.5.1" is incompatible with requested version "mkdirp@^1.0.3" verbose 1.5052446 Performing "GET" request to "http://mavencentral.it.abc.com:8081/nexus/repository/npm-idp/@idp%2fbusiness-features". verbose 2.3941144 Request "http://mavencentral.it.abc.com:8081/nexus/repository/npm-idp/@idp%2fbusiness-features" finished with status code 404. verbose 2.4090686 Error: Couldn't find package "@idp/business-features" on the "npm" registry. at MessageError.ExtendableBuiltin (C:\Program Files (x86)\Yarn\lib\cli.js:721:66) at new MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:750:123) at NpmResolver. (C:\Program Files (x86)\Yarn\lib\cli.js:50302:15) at Generator.next () at step (C:\Program Files (x86)\Yarn\lib\cli.js:304:30) at C:\Program Files (x86)\Yarn\lib\cli.js:315:13 at processTicksAndRejections (internal/process/task_queues.js:97:5) error Couldn't find package "@idp/business-features" on the "npm" registry. info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. info There appears to be trouble with your network connection. Retrying... verbose 5.4384625 Performing "GET" request to "https://yarnpkg.com/latest-version". info There appears to be trouble with your network connection. Retrying... verbose 9.507949699 Performing "GET" request to "https://yarnpkg.com/latest-version". info There appears to be trouble with your network connection. Retrying... verbose 13.5569681 Performing "GET" request to "https://yarnpkg.com/latest-version". info There appears to be trouble with your network connection. Retrying... verbose 17.300063699 Performing "GET" request to "https://yarnpkg.com/latest-version".

ThisIsRuddy commented 4 years ago

I was able to solve this error by running npm login and logging in again.

You sir, are a legend! I've had this error happen so many times and it always seems to sort itself out a few hours later. I just simply registered on the npm website and logged in with the command and tried to reinstall, all working now!

AndrianinaH commented 4 years ago

I was able to solve this error by running npm login and logging in again.

You sir, are a legend! I've had this error happen so many times and it always seems to sort itself out a few hours later. I just simply registered on the npm website and logged in with the command and tried to reinstall, all working now!

i confirm, this solution work, you save my day

fedevitch commented 4 years ago

https://status.npmjs.org/incidents/cksjqc1w11v5 this is some npm registry issue

miestr commented 4 years ago

Experiencing it without any reason today (all jenkins pipelines failing, yarn install also failing locally). Nothing from the provided responses did help. Any ideas how to fix it? verbose 15.803 Request "https://registry.npmjs.org/@redux-saga%2fcore" finished with status code 404. verbose 15.815 Error: Couldn't find package "@redux-saga/core@^1.0.0" required by "redux-saga@1.0.0" on the "npm" registry.

fedevitch commented 4 years ago

npm login was temporary workaround but seems like npm registry is fixed now and errors should be gone

mansoor292 commented 4 years ago

having this issue early on a sunday morning, hoping its fixed by tomorrow or build pipeline hell. Is definitely related to escaping of urls. Right now working with --prefer-offline.

I did install v2, regretted it, and tried to move back 1.22.5 yesterday. But I believe it was unrelated although I cannot remember at this point. no .yarn .yarnrc removed as well.

zackphilipps commented 4 years ago

I have a different registry set in .npmrc, but npm install handles that just fine. What gives with yarn?

Catcheer commented 3 years ago

use cnpm link worked

shirakaba commented 3 years ago

Waiting an hour worked 🙃

StringKe commented 3 years ago

If you are using a private npm registry to try to configure always auth, there are some private repositories that require authentication for all packages.

try set npm(~/.npmrc) config add always auth

always-auth=true
 # your private npm register
registry=xxxxxx
1248499257 commented 2 years ago

If you are using a private npm registry to try to configure always auth, there are some private repositories that require authentication for all packages.

try set npm(~/.npmrc) config add always auth

always-auth=true
 # your private npm register
registry=xxxxxx

This works for me, but I have a question, why I can't get access after logging out of npm, but after logging in to yarn

tranhoangduong1994 commented 2 years ago

I was able to solve this error by running npm login and logging in again.

This works for me! 🎉

lisez commented 2 years ago

After I removed the --install.prefer-offline true from .yarnrc, it works.

I cannot figure out why.

dengbuladuo commented 2 years ago

If you are using a private npm registry to try to configure always auth, there are some private repositories that require authentication for all packages.

try set npm(~/.npmrc) config add always auth

always-auth=true
 # your private npm register
registry=xxxxxx

i tried this , it works , thanks!!

squarewave24 commented 1 year ago

im having a similar issue with .yarnrc

this works 👍

yarn add web-components --registry https://artifactory.myco.com/artifactory/api/npm/myco/

but when i do the same in .yarnrc 👎

"@myscope:registry" "https://artifactory.myco.com/artifactory/api/npm/myco/"

and try referencing in package.json

"dependencies": {
    "@myscope/web-components": "0.0.29",

i get:


yarn install --verbose
Performing "GET" request to "https://artifactory.mycompany.com/artifactory/api/npm/myco/@myscope%2fweb-components".

Request "https://artifactory.mycompany.com/artifactory/api/npm/myco/@myscope%2fweb-components" finished with status code 404.

Error: Couldn't find package "@myscope/web-components@0.0.29" required by "web@0.1.0" on the "npm" registry.

it appears to be appending scope name to the url?

Yaolegol commented 1 year ago

So, why this issue is closed?

rally25rs commented 1 year ago

@squarewave24

it appears to be appending scope name to the url?

I believe that is the correct behavior for the URL. yarn add web-components and yarn add @myco/web-components are different packages that would resolve to different urls. The scope is not removed just because your configuration specifies a registry for a scope. I assume your web-components is published to artifactory without a scope, so it would not be covered by "@myscope:registry". You likely want to be publishing your library to artifactory with the @myscope scope.

@Yaolegol

So, why this issue is closed?

Because the person who opened the issue resolved it by fixing their configuration, and closed the issue since they are no longer having a problem. If you are having an issue, you can open a new issue for your specific case.

AbdeenM commented 1 year ago

In my case i was running into random packages not installing while locally they are installing just fine, none of the above solutions worked. However i was running node18 and i noticed my Dockerfile was using node:alpine, changing that to node:18-alpine resolved my issues

SuperPlatipus commented 1 year ago

I'm having a similar issue, just that it seems like the package disapeared (?)

By instance, going to the package url just {"error":"Not found"}

https://registry.yarnpkg.com/@tensorflow/tfjs-webgpu

Is there a posibility there is an issue with the NPM repository itself?

Neo-Ciber94 commented 1 year ago

In my case the error was my package version was 0.0.1-alpha.0 I changed to 0.0.1 and now works

idl-asad commented 1 year ago

If you are using a private npm registry to try to configure always auth, there are some private repositories that require authentication for all packages.

try set npm(~/.npmrc) config add always auth

always-auth=true
 # your private npm register
registry=xxxxxx

This works for me, thanks @StringKe :)

geektcp commented 1 year ago

I see the same issue, but I have no solution to fix it. I suspect this issue is related to OpenSSL.

yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred:
 "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz: incorrect data check".
info If you think this is a bug, 
please open a bug report with the information provided in "/code/test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install 
for documentation about this command.
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at 
https://registry.npmjs.org/minipass reason: 
Invalid response body while trying to fetch 
https://registry.npmjs.org/minipass: 140362052921280
:error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac:
../deps/openssl/openssl/ssl/record/ssl3_record.c:677:
npm ERR! 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-10-04T07_02_44_972Z-debug-0.log

npm --version 8.19.4

yarn --version 1.22.19

openssl version OpenSSL 1.0.2k-fips 26 Jan 2017