yarn icon indicating copy to clipboard operation
yarn copied to clipboard

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

Open roytz opened this issue 8 years ago • 56 comments

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

roytz avatar Jun 24 '18 22:06 roytz

@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?

hulkish avatar Jun 24 '18 22:06 hulkish

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

roytz avatar Jun 24 '18 23:06 roytz

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 avatar Nov 28 '18 15:11 aleclarson

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..

aleclarson avatar Nov 28 '18 15:11 aleclarson

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.

alvincrespo avatar Nov 28 '18 16:11 alvincrespo

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.

j-walker23 avatar Nov 28 '18 18:11 j-walker23

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

giltotherescue avatar Nov 28 '18 19:11 giltotherescue

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.

nshoes avatar Nov 28 '18 20:11 nshoes

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.

cameron-martin avatar Nov 28 '18 21:11 cameron-martin

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.

aleclarson avatar Nov 28 '18 22:11 aleclarson

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

nshoes avatar Nov 28 '18 22:11 nshoes

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

eurycea avatar Nov 28 '18 22:11 eurycea

@eurycea that blog post fully explains it for my case

cameron-martin avatar Nov 28 '18 23:11 cameron-martin

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.

hulkish avatar Nov 28 '18 23:11 hulkish

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

Adnan-Toky avatar May 09 '19 10:05 Adnan-Toky

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

seeliang avatar Oct 29 '19 01:10 seeliang

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.

enderim avatar Dec 08 '19 17:12 enderim

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

raphaelsoul avatar Dec 16 '19 10:12 raphaelsoul

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

pflugs30 avatar Feb 12 '20 00:02 pflugs30

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

evheniy avatar Feb 12 '20 09:02 evheniy