2
對於我的大部分項目,我已經成功地從npm轉移到Yarn。但是我的角2個項目導致錯誤:爲什麼Yarn不能安裝Angular 2的作用域包(例如@ angular/common)?
$ 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.
利用角提供的快速入門的一個,即使:
$ 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運行),我有一種感覺它是關於在作用域包名的符號@?
我不能使用複製Ubuntu 16.10上的v0.17.8。嘗試清理Yarn緩存('清理紗線緩存')並重新運行。另外,我認爲其他沒有作用域的包(使用@)工作正常嗎?測試'npm install @ angular/common'是否正常工作以排除任何網絡問題也可能會有幫助。 – Aurora0001
'npm install @ angular/common'可以正常工作,就像'npm install'一樣,例如快速啓動。只是注意到上面的快速入門的錯誤是在'「@ types/node」'(在'@ angular/forms'之前')。似乎是我的安裝上的@真的有問題嗎? –
這似乎很奇怪。 [這個bug](https://github.com/yarnpkg/yarn/issues/1260)看起來很相似 - 你使用代理嗎? – Aurora0001