我正在关注Angular 2的Tuts +教程中。在此视频中:https://code.tutsplus.com/courses/whats-new-in-angular-2/lessons/angular-2-and-es5作者说要输入以下命令:
npm install angular2 --save
我尝试过,以及在它前面使用sudo
,但得到以下错误:
npm WARN package.json angular2tuts@1.0.0 No description
npm WARN package.json angular2tuts@1.0.0 No repository field.
npm WARN package.json angular2tuts@1.0.0 No README data
npm ERR! Darwin 15.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "angular2" "--save"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ETARGET
npm ERR! notarget No compatible version found: angular2@'*'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["2.0.0-alpha.8.dev","2.0.0-alpha.8.prod","2.0.0-alpha.11","2.0.0-alpha.12","2.0.0-alpha.13","2.0.0-alpha.14","2.0.0-alpha.15","2.0.0-alpha.16","2.0.0-alpha.17","2.0.0-alpha.18","2.0.0-alpha.19","2.0.0-alpha.20","2.0.0-alpha.21","2.0.0-alpha.22","2.0.0-alpha.23","2.0.0-alpha.24","2.0.0-alpha.25","2.0.0-alpha.26","2.0.0-alpha.27","2.0.0-alpha.28","2.0.0-alpha.29","2.0.0-alpha.30","2.0.0-alpha.31","2.0.0-alpha.32","2.0.0-alpha.33","2.0.0-alpha.34","2.0.0-alpha.35","2.0.0-alpha.36","2.0.0-alpha.37","2.0.0-alpha.38","2.0.0-alpha.39","2.0.0-alpha.40","2.0.0-alpha.41","2.0.0-alpha.42","2.0.0-alpha.44","2.0.0-alpha.45","2.0.0-alpha.46","2.0.0-alpha.47","2.0.0-alpha.48","2.0.0-alpha.49","2.0.0-alpha.50","2.0.0-alpha.51","2.0.0-alpha.52","2.0.0-alpha.53","2.0.0-alpha.54","2.0.0-alpha.55","2.0.0-beta.0","2.0.0-beta.1"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
想法?
作者能够做到没有错误:
答案 0 :(得分:4)
要使用npm安装angular2,您可以指定版本或使用@latest
npm install angular2@2.0.0-beta.1 --save
latest
(这显然会安装npm中提供的最新版本)npm install angular2@latest --save
请注意,有计划支持angular@next
,这将增加安装 nightly 版本的可能性,但它尚不支持(到目前为止,快照已从不时,但命令尚不可用)。查看issue #4671了解详情。