对于我的大部分项目,我已成功从npm转移到Yarn。但是我的Angular 2项目导致错误:
$ yarn add "@angular/common"
yarn add v0.17.8
info No lockfile found.
[1/4] Resolving packages...
error Couldn't find package "@angular/common" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
即使使用Angular提供的快速入门之一:
$ git clone https://github.com/angular/quickstart.git quickstart && cd quickstart
…
$ yarn install
yarn install v0.17.8
info No lockfile found.
[1/4] Resolving packages...
error Couldn't find package "@types/node" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
我错过了一些明显的东西吗?我没有看到任何其他帖子出现此问题,因此可能是环境问题?
$ yarn versions
yarn versions v0.17.8
{ yarn: '0.17.8',
'angular-quickstart': '1.0.0',
http_parser: '2.7.0',
node: '6.9.1',
v8: '5.1.281.84',
uv: '1.9.1',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '57.1',
modules: '48',
openssl: '1.0.2j' }
Done in 0.06s.
(我在linux / f25上运行)
我觉得它是关于作用域包名中的@ -symbol?
答案 0 :(得分:2)
纱线中似乎存在一个错误,它将带有at符号的URL视为需要身份验证的网址。然后,它使用_auth
配置添加auth标头。 (我有'_auth'npm配置)
以下解决了这个问题(解决这个问题直到解决):
$ npm config delete _auth