2017-12-27 264 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清潔解決你的問題 –