Yarn: Scoped Packages - "yarn add" (not "yarn") throws error

Created on 21 Jan 2018  ยท  7Comments  ยท  Source: yarnpkg/yarn

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

What is the current behavior?

Yarn add command cannot install this published package: https://www.npmjs.com/package/@google-cloud/translate

$ yarn add @google-cloud/translate
yarn add v1.3.2
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@google-cloud/
translate: Not found".

npm can install it correctly:

$npm install @google-cloud/translate --save

"yarn" does install it correctly if it is in the package.json, it is just "yarn add" that fails.

Interestingly, bluebird gives a slightly different error:

$ yarn add @types/bluebird
yarn add v1.3.2
[1/4] Resolving packages...
error Couldn't find package "@types\\bluebird" on the "npm" registry.

Both work from package.json, and wrapping them in quotes in yarn add doesn't matter.

Please mention your node.js, yarn and operating system version.
yarn 1.3.2
node v8.9.4
Windows 7

Related: #4354 #4366

needs-confirmation os-windows

Most helpful comment

No, I still see the issue on windows 7.

$ yarn add @google-cloud/translate
yarn add v1.4.1-20180129.1936
info No lockfile found.
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@google-cloud/
translate: Not found".

All 7 comments

Seems to work OK for me.

~/Projects/yarn-test ๐Ÿ’   yarn add @google-cloud/translate
yarn add v1.4.0
info No lockfile found.
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
success Saved lockfile.
success Saved 94 new dependencies.
โœจ  Done in 2.99s.

~/Projects/yarn-test ๐Ÿ’   yarn add @types/bluebird
yarn add v1.4.0
warning package.json: No license field
warning No license field
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
โ””โ”€ @types/[email protected]
warning No license field
โœจ  Done in 0.73s.

~/Projects/yarn-test ๐Ÿ’   cat package.json
{
  "dependencies": {
    "@google-cloud/translate": "^1.1.0",
    "@types/bluebird": "^3.5.20"
  }
}
~/Projects/yarn-test ๐Ÿ’   rm -rf node_modules/

~/Projects/yarn-test ๐Ÿ’   yarn
yarn install v1.4.0
warning package.json: No license field
warning No license field
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
โœจ  Done in 0.72s.

Maybe try upgrading to yarn v1.4 and see if it's already fixed?

No, I still see the issue on windows 7.

$ yarn add @google-cloud/translate
yarn add v1.4.1-20180129.1936
info No lockfile found.
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@google-cloud/
translate: Not found".

Still an issue on win10 with yarn 1.6.0
Seems like it has something to do with scoped packages. I don't have problem installing those without '@'

$ yarn add @ngx-translate/core
yarn add v1.6.0
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@ngx-translate/core: 
Not found".

I still can't reproduce this. Tried on Win 10, yarn 1.5.1, powershell and it still worked for me. If someone why can consistently reproduce this can help debug, we would appreciate it.

What _should_ happen is that yarn uses the url https://registry.yarnpkg.com/@google-cloud%2ftranslate but instead it is putting a / instead of the %2f.

I was playing around and found out it doesn't happen in windows terminal, but it fails when attempting yarn add @ngx-translate/core in git bash.

Can confirm this issue. Package: https://www.npmjs.com/package/@types/react I realize now it's because of a typo: types/react (correct) vs typed/react (what i tried). Sorry for wasting everyone's time.

$> yarn add --dev @typed/react                                                                                     
yarn add v1.5.1
[1/4] ๐Ÿ”  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@typed%2freact: Not found".
info If you think this is a bug, please open a bug report with the information provided in "[stripped]".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

macOS 10.13.2
iTerm2 3.1.6
fish 2.7.1 / bash 3.2
yarn 1.5.1
node 8.9.3

Problem persists after upgrading to node 9.11.1 and yarn 1.6.0. Same if I add the package to my package.json:

$> yarn                                                                                                             14:33:58
yarn install v1.6.0
[1/4] ๐Ÿ”  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@typed%2freact: Not found".

Can confirm this issue
Ubuntu 20.04
Yarn 1.22.5
Node 12.18.0
Zsh 5.8

Was this page helpful?
0 / 5 - 0 ratings