1

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

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

这是假设可以转换为角度 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
4

1 回答 1

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",

于 2017-03-01T08:04:37.157 回答