使用npm更新Angular时出错

时间:2017-12-27 13:08:26

标签: angular npm

我真的很茫然。我为我的应用程序安装了ngx-translate,但它需要我更新我的@ angular / core和rxjs。我决定使用https://angular-update-guide.firebaseapp.com/完全更新Angular。它告诉我:

npm install @angular/animations@'^5.0.0' @angular/common@'^5.0.0'
@angular/compiler@'^5.0.0' @angular/compiler-cli@'^5.0.0' @angular/core@'^5.0.0' 
@angular/forms@'^5.0.0' @angular/http@'^5.0.0' @angular/platform-browser@'^5.0.0' 
@angular/platform-browser-dynamic@'^5.0.0' 
@angular/platform-server@'^5.0.0' @angular/router@'^5.0.0'typescript@2.4.2 rxjs@'^5.5.2'

当我将其粘贴到我的控制台并点击回车时,我收到以下错误:

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "@angular/animations@'5.0.0'" "@angular/common@'5.0.0'" "@angular/compiler@'5.0.0'" "@angular/compiler-cli@'5.0.0'" "@angular/core@'5.0.0'" "@angular/forms@'5.0.0'" "@angular/http@'5.0.0'" "@angular/platform-browser@'5.0.0'" "@angular/platform-browser-dynamic@'5.0.0'" "@angular/platform-server@'5.0.0'" "@angular/router@'5.0.0'" "typescript@2.4.2" "rxjs@'5.5.2'"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ETARGET

npm ERR! notarget No compatible version found: rxjs@'5.5.2'
npm ERR! notarget Valid install targets:
npm ERR! notarget 6.0.0-alpha.0, 5.5.6, 5.5.5, 5.5.4, 5.5.3, 5.5.2, 5.5.1, 5.5.0, 5.5.0-beta.7, 5.5.0-beta.5, 5.5.0-beta.4, 5.5.0-beta.3, 5.5.0-beta.2, 5.5.0-beta.1, 5.5.0-beta.0, 5.4.3, 5.4.2, 5.4.1, 5.4.0, 5.3.3, 5.3.1, 5.3.0, 5.2.1-smooth, 5.2.0, 5.1.1, 5.1.0, 5.0.3, 5.0.2, 5.0.1, 5.0.0, 5.0.0-rc.5, 5.0.0-rc.4, 5.0.0-rc.3, 5.0.0-rc.2, 5.0.0-rc.1, 5.0.0-beta.12, 5.0.0-beta.11, 5.0.0-beta.10, 5.0.0-beta.9, 5.0.0-beta.8, 5.0.0-beta.7, 5.0.0-beta.6, 5.0.0-beta.5, 5.0.0-beta.4, 5.0.0-beta.3, 5.0.0-beta.2, 5.0.0-beta.1, 5.0.0-beta.0, 5.0.0-alpha.14, 5.0.0-alpha.13, 5.0.0-alpha.12, 5.0.0-alpha.11, 5.0.0-alpha.10
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.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\pdws-view-v2\npm-debug.log

我还试图只更新@ angular / core和rxjs,但是当我举例npm install @angular/core@5.0.0时,我收到了以下消息:

+-- @angular/cli@1.2.0
| `-- rxjs@5.5.6
|   `-- symbol-observable@1.0.1
+-- UNMET PEER DEPENDENCY @angular/core@5.0.0
`-- UNMET PEER DEPENDENCY  (rxjs) invalid error: ENOENT: no such file or directory, open 'c:\pdws-view-v2\node_modules\rxjs\package.json

还有一堆像这样的警告:

npm WARN @angular/animations@4.4.4 requires a peer of @angular/core@4.4.4 but none was installed.

此外,在尝试安装这些后,我的应用程序将不再编译,给我这个错误:

Failed to compile.

./~/@angular/core/@angular/core.es5.js
Module build failed: Error: ENOENT: no such file or directory, open 'c:\pdws-view-v2\node_modules\@angular\core\@angular\core.es5.js'
    at Error (native)
 @ ./src/main.ts 1:0-47
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

此时我该怎么办?感谢。

1 个答案:

答案 0 :(得分:0)

清除缓存并重新安装

npm cache clean
npm install @angular/animations@'^5.0.0' @angular/common@'^5.0.0'
@angular/compiler@'^5.0.0' @angular/compiler-cli@'^5.0.0' @angular/core@'^5.0.0' 
@angular/forms@'^5.0.0' @angular/http@'^5.0.0' @angular/platform-browser@'^5.0.0' 
@angular/platform-browser-dynamic@'^5.0.0' 
@angular/platform-server@'^5.0.0' @angular/router@'^5.0.0'typescript@2.4.2 rxjs@'^5.5.2'