简体   繁体   English

Angular 2未使用npm安装

[英]Angular 2 is not installing using npm

While installing angular 2 it shows the following error: 在安装Angular 2时,它显示以下错误:

npm ERR! Windows_NT 6.1.7601

npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ic020019\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "angular@2"

npm ERR! node v4.4.2

npm ERR! npm  v3.10.5

npm ERR! No compatible version found: angular@2
npm ERR! Valid install targets:
npm ERR! 1.5.8, 1.5.7, 1.5.6, 1.5.5, 1.5.3, 1.5.2, 1.5.1, 1.5.0, 1.5.0-rc.2, 1.5.0-rc.1, 1.5.0-rc.0, 1.5.0-beta.2, 1.5.0-beta.0, 1.4.12, 1.4.11, 1.4.10, 1.4.9, 1.4.8, 1.4.7, 1.4.6, 1.4.5, 1.4.4
, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.4.0-rc.2, 1.4.0-rc.1, 1.4.0-rc.0, 1.4.0-beta.6, 1.4.0-beta.5, 1.4.0-beta.4, 1.4.0-beta.3, 1.4.0-beta.2, 1.4.0-beta.1, 1.4.0-beta.0, 1.3.20, 1.3.19, 1.3.18, 1.3.1
7, 1.3.16, 1.3.15, 1.3.14, 1.3.13, 1.3.12, 1.3.11, 1.3.10, 1.3.9, 1.3.8, 1.3.7, 1.3.6, 1.3.5, 1.3.4, 1.3.4-build.3588, 1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.3.0-rc.5, 1.2.30, 1.2.29, 1.2.28, 1.2.27, 1.
2.23, 1.2.22, 1.2.21, 1.2.20, 1.2.19, 1.2.18, 1.2.17, 1.2.16, 1.2.15, 1.2.14, 1.2.13, 1.2.12, 1.2.11, 1.2.10, 1.2.9, 1.2.8, 1.2.7, 1.2.6, 1.2.5, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.5, 1.1.4,
 1.1.3, 1.1.2, 1.1.1, 1.1.0, 1.0.8, 1.0.7, 1.0.6, 1.0.5, 1.0.4, 1.0.3, 1.0.2, 1.0.1, 1.0.0, 0.0.4, 0.0.3, 0.0.2, 0.0.1, 0.0.1-2, 0.0.1-1
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     D:\SSP\angular 2 POC\npm-debug.log

How can I resolve this? 我该如何解决?

Angular 2 is in a different package than angular 1: https://www.npmjs.com/package/angular2 角度2与角度1的包装不同: https//www.npmjs.com/package/angular2

For example, you could install it using npm install angular2 . 例如,您可以使用npm install angular2安装它。

To install Angular2 you can use the command npm install angular2 . 要安装Angular2,可以使用命令npm install angular2 Another way of doing it is to add the package and version number to your package.json file. 另一种方法是将软件包和版本号添加到package.json文件中。 For example: 例如:

...
"dependencies": {
    "angular2": "2.0.0-beta.17"`
}
...

You then need to run npm install in your project root. 然后,您需要在项目根目录中运行npm install

However .... I wouldn't use the Angular2 npm package, because it's a little out of date now (at the time of writing, this may change after full release). 但是 ....我不会使用Angular2 npm软件包,因为它现在已经有点过时了(在撰写本文时,在完全发布后可能会有所变化)。 The development team has split the main areas of functionality into separate sub-packages. 开发团队已将功能的主要领域划分为单独的子包。 To use these you will need to import them individually into your package.json file. 要使用它们,您需要将它们分别导入到package.json文件中。 For Example: 例如:

...
"dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "0.1.1",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/platform-server": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.2"
}
...

Installation of the current version of Angular 2 is split up into several packages: 当前版本的Angular 2的安装分为几个软件包:

Just install all of those with npm install 只需使用npm install安装所有这些

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM