2017-12-27 346 views
1

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

npm install @angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' 
@angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' 
@angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' 
@angular/[email protected]'^5.0.0' 
@angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0'[email protected] [email protected]'^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/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "@angular/[email protected]'5.0.0'" "[email protected]" "[email protected]'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: [email protected]'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 

我也试图只更新@角/核心和rxjs ,但是当我如npm install @angular/[email protected]我得到这些消息:

+-- @angular/[email protected] 
| `-- [email protected] 
| `-- [email protected] 
+-- UNMET PEER DEPENDENCY @angular/[email protected] 
`-- 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/[email protected] requires a peer of @angular/[email protected] 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 

我怎么在这一点呢?谢谢。

回答

0

清除缓存和重新安装

npm cache clean 
npm install @angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' 
@angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' 
@angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0' 
@angular/[email protected]'^5.0.0' 
@angular/[email protected]'^5.0.0' @angular/[email protected]'^5.0.0'[email protected] [email protected]'^5.5.2' 
+0

任何理由,你为什么只提到@角/动画和@角/共同点? – Jesper

+0

对不起,我忘了添加其他:) –

+0

是否NPM清洁解决你的问题 –