Yarn: Yarn fails for @types scoped packages when using a private registry and pointing to a public one for the scoped packages

Created on 9 Nov 2016  ·  4Comments  ·  Source: yarnpkg/yarn

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

What is the current behavior?
Relevent npm configuration:

registry=http://my-internal-private-registry.com
@types:registry=http://registry.npmjs.org/

When attempting to install protractor, yarn fails with the following error in yarn-error.log

Trace:
  TypeError: Cannot use 'in' operator to search for '^2.5.36' in undefined
      at /usr/share/yarn/lib-legacy/resolvers/registries/npm-resolver.js:74:24
      at next (native)
      at step (/usr/share/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
      at /usr/share/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
      at new Promise (/usr/share/yarn/node_modules/core-js/library/modules/es6.promise.js:191:7)
      at /usr/share/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12
      at Function.findVersionInRegistryResponse (/usr/share/yarn/lib-legacy/resolvers/registries/npm-resolver.js:84:7)
      at /usr/share/yarn/lib-legacy/resolvers/registries/npm-resolver.js:101:34
      at next (native)
      at step (/usr/share/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

If the current behavior is a bug, please provide the steps to reproduce.
Configure npm to point to a private registry, but point to a scoped registry for types

registry=http://my-internal-private-registry.com
@types:registry=http://registry.npmjs.org/

run

yarn add protractor

What is the expected behavior?
Protractor installs correctly. Running "npm install protractor" installs as expected.

Please mention your node.js, yarn and operating system version.
node 4.6.1, yarn 0.16.1, Ubuntu 14.04

Most helpful comment

What version was this fixed on? I am using the latest stable v0.19.1 and I am seeing this issue.

$ npm install @types/react
[email protected] /Users/$user/dev/envs/dev/x
└── @types/[email protected]

$ yarn add @types/react
yarn add v0.19.1
[1/4] 🔍  Resolving packages...
error Couldn't find package "@types/react" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
$

All 4 comments

This error has been fixed on master and will be in the next release.

What version was this fixed on? I am using the latest stable v0.19.1 and I am seeing this issue.

$ npm install @types/react
[email protected] /Users/$user/dev/envs/dev/x
└── @types/[email protected]

$ yarn add @types/react
yarn add v0.19.1
[1/4] 🔍  Resolving packages...
error Couldn't find package "@types/react" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
$

Same problem here on v0.24.5 with '@'types/node

Was this page helpful?
0 / 5 - 0 ratings