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

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

Closed
roytz opened this issue Jun 24, 2018 · 54 comments
Closed

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

roytz opened this issue Jun 24, 2018 · 54 comments
Assignees
Labels

Comments

@roytz
Copy link

roytz commented Jun 24, 2018

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

@ghost ghost assigned rally25rs Jun 24, 2018
@ghost ghost added the triaged label Jun 24, 2018
@hulkish
Copy link
Contributor

hulkish commented Jun 24, 2018

@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
Copy link
Author

roytz commented Jun 24, 2018

@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
Copy link

aleclarson commented Nov 28, 2018

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

  • Using yarn cache clean does not help.
  • Reinstalling yarn with Homebrew does not help.
  • Running yarn with sudo does not help.

 

Versions

  • macOS v10.13.6
  • node v11.1.0
  • yarn v1.12.3

@aleclarson
Copy link

aleclarson commented Nov 28, 2018

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
Copy link

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
Copy link

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
Copy link

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

@nshoes
Copy link

nshoes commented Nov 28, 2018

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
Copy link

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
Copy link

aleclarson commented Nov 28, 2018

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
Copy link

nshoes commented Nov 28, 2018

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

@eurycea
Copy link

eurycea commented Nov 28, 2018

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

@cameron-martin
Copy link

@eurycea that blog post fully explains it for my case

@hulkish
Copy link
Contributor

hulkish commented Nov 28, 2018

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
Copy link

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

@seeliang
Copy link

seeliang commented Oct 29, 2019

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
Copy link

eaorak commented Dec 8, 2019

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
Copy link

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
Copy link

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

@evheniy
Copy link

evheniy commented Feb 12, 2020

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
Copy link

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
Copy link

jacobq commented Feb 12, 2020

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.<anonymous> (/usr/share/yarn/lib/cli.js:141637:10)
    at Request.emit (events.js:223:5)
    at IncomingMessage.<anonymous> (/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
Copy link

yovanoc commented Feb 12, 2020

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
Copy link

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

@InsOpDe
Copy link

InsOpDe commented May 22, 2020

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
Copy link

I am facing the same issue.

@rituriteshritz
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@miestr
Copy link

miestr commented Aug 6, 2020

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
Copy link

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

@mansoor292
Copy link

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
Copy link

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

@Catcheer
Copy link

use cnpm link worked

@shirakaba
Copy link

Waiting an hour worked 🙃

@StringKe
Copy link

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
Copy link

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
Copy link

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

This works for me! 🎉

@lisez
Copy link

lisez commented Apr 8, 2022

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

I cannot figure out why.

@dengbuladuo
Copy link

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
Copy link

squarewave24 commented Jan 3, 2023

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
Copy link

So, why this issue is closed?

@rally25rs
Copy link
Contributor

@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
Copy link

AbdeenM commented Jun 6, 2023

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
Copy link

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
Copy link

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
Copy link

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
Copy link

geektcp commented Oct 4, 2023

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
  • os
CentOS7.9
  • node
node --version
v16.20.2

npm --version
8.19.4

yarn --version
1.22.19

openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017

@yasin-herken
Copy link

I deleted the yarn.lock file and reinstall it from scratch. It fixed

@ahaverdings
Copy link

ahaverdings commented Apr 22, 2024

Cost me a couple of days to find out that this error only happens for me when the version of the workspace (and dependant package) contains a version any other than a specfic semver. e.g. 1.0.1-SNAPSHOT.

So this fails: "version": "1.0.1-SNAPSHOT"
This is succesful: "version": "1.0.1"

I think this might be a limitation with yarn workspace function that internally parses version numbers somewhere and fails causing the packages to be searched on npm which in turn also fails because it doesn't exist there.

might be related to: #8567
I think upgrading semver dependency might go a long way

@Alkhatri77
Copy link

Help my please

@veryvorobey
Copy link

In my case the problem was that the location of newly added package wasn't mentioned in "workspaces" property of package.json 🙂

"workspaces": [ "src/utils/newly-added-package" ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests