问题
I am trying to use the following command to upgrade to Angular 4 Rc1
npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save
This is the command that is suppose to work to convert to angular 4
https://github.com/angular/angular/blob/master/CHANGELOG.md
But this Command is giving me a error
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:
If this command is not working
npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save
then try individually like this-
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
Running commands individually helps for me and now dependencies in package.json
looks like this-
"@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",
Also keep in mind, you need "typescript": "^2.1.6",
来源:https://stackoverflow.com/questions/42516188/cannot-upgrade-a-existing-angular-cli-project-to-angular-4-rc1