无法将现有的Angular Cli项目升级到Angular 4 Rc1

时间:2017-02-28 18:28:11

标签: angular npm angular4

我正在尝试使用以下命令升级到Angular 4 Rc1

npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save

这是可以转换为angular 4

的命令
https://github.com/angular/angular/blob/master/CHANGELOG.md

但是这个命令给了我一个错误

E:\Softwares\Angular2\Angular2Concepts>npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@ne
xt --save
npm ERR! addLocal Could not install E:\Softwares\Angular2\Angular2Concepts\@angular\{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-serv
er,router,animations}@next
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "@angular/{common,compiler,compiler-cli,core,forms,http,pla
tform-browser,platform-browser-dynamic,platform-server,router,animations}@next" "--save"
npm ERR! node v7.2.1
npm ERR! npm  v3.10.10
npm ERR! path E:\Softwares\Angular2\Angular2Concepts\@angular\{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@
next
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'E:\Softwares\Angular2\Angular2Concepts\@angular\{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-
dynamic,platform-server,router,animations}@next'
npm ERR! enoent ENOENT: no such file or directory, open 'E:\Softwares\Angular2\Angular2Concepts\@angular\{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-
dynamic,platform-server,router,animations}@next'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     E:\Softwares\Angular2\Angular2Concepts\npm-debug.log

1 个答案:

答案 0 :(得分:0)

如果此命令不起作用

npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save

然后单独尝试 -

npm install @angular/common@next --save
npm install @angular/compiler@next --save
npm install @angular/compiler-cli@next --save
npm install @angular/core@next --save
npm install @angular/forms@next --save
npm install @angular/http@next --save
npm install @angular/platform-browser@next --save
npm install @angular/platform-browser-dynamic@next --save
npm install @angular/platform-server@next --save
npm install @angular/router@next --save
npm install @angular/animations@next --save

单独运行命令对我有帮助,现在package.json中的依赖关系看起来像这样 -

"@angular/animations": "^4.0.0-rc.1",
"@angular/common": "^4.0.0-rc.1",
"@angular/compiler": "^4.0.0-rc.1",
"@angular/compiler-cli": "^4.0.0-rc.1",
"@angular/core": "^4.0.0-rc.1",
"@angular/forms": "^4.0.0-rc.1",
"@angular/http": "^4.0.0-rc.1",
"@angular/platform-browser": "^4.0.0-rc.1",
"@angular/platform-browser-dynamic": "^4.0.0-rc.1",
"@angular/platform-server": "^4.0.0-rc.1",
"@angular/router": "^4.0.0-rc.1", 

另请注意,您需要"typescript": "^2.1.6",