我想将我的应用程序从angular4升级到angular5。我需要在package.json
进行哪些更改?
以下是我的依赖项:
"dependencies": {
"@material/fab": "^0.28.0",
"@progress/kendo-angular-charts": "1.2.1",
"@progress/kendo-angular-dateinputs": "1.0.5",
"@progress/kendo-angular-dropdowns": "1.1.1",
"@progress/kendo-angular-excel-export": "1.0.3",
"@progress/kendo-angular-grid": "1.1.3",
"@progress/kendo-angular-inputs": "1.0.6",
"@progress/kendo-angular-intl": "1.2.1",
"@progress/kendo-angular-l10n": "1.0.2",
"@progress/kendo-data-query": "1.0.5",
"@progress/kendo-drawing": "1.1.1",
"angular-2-dropdown-multiselect": "1.5.4",
"angular-tree-component": "4.1.0",
"angular2-cool-storage": "3.1.0",
"core-js": "2.5.0",
"hammerjs": "2.0.8",
"mydatepicker": "2.0.27",
"ng-sidebar": "6.0.1",
"ng2-device-detector": "^1.0.0",
"ng2-dnd": "4.2.0",
"ng2-dropdown-treeview": "2.0.1",
"ng2-toasty": "4.0.3",
"ng2draggable": "1.3.2",
"ngx-bootstrap": "1.9.3",
"ngx-clipboard": "8.0.4",
"primeng": "4.1.3",
"rxjs": "5.4.3",
"typescript": "2.3.4",
"zone.js": "0.8.16"
}, "devDependencies": {
"@angular/cli": "1.3.0",
"@angular/compiler-cli": "4.3.4",
"@types/jasmine": "2.5.53",
"@types/node": "8.0.22",
"codelyzer": "3.2.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "1.7.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-coverage-istanbul-reporter": "1.3.0",
"protractor": "5.1.2",
"ts-node": "3.3.0",
"tslint": "5.7.0",
"typescript": "2.5.2"
}
答案 0 :(得分:1)
根据我的经验,我建议您使用最新的@ angular / cli创建一个新项目,然后将代码复制到那里。它比配置angular 5更容易,特别是如果你弹出了你的项目,因为webpack配置非常不同,你只需要更新包就会遇到很多错误。
答案 1 :(得分:0)
只需按照此命令
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
您必须升级Angular CLI以避免一些冲突 此命令将升级您的全局包
npm uninstall -g @angular/cli
npm cache verify
# if npm version is < 5 then use `npm cache clean`
npm install -g @angular/cli@latest
此命令将升级您的本地包
rm -rf node_modules dist <-- in mac os
# use rmdir /S/Q node_modules dist <--- in Windows Command Prompt;
use rm -r -fo node_modules,dist <--- in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install
我曾经将项目从角度4升级到角度5,我得到了一个小bug,因为我使用了一些在角度4中弃用的库, 所以我的建议是备份你的项目,并尝试升级它! 大声笑,希望你喜欢:)
P.S。我从某个地方复制了这段代码并没有保存路径抱歉没有给出这个代码的功劳
答案 2 :(得分:0)
您可以在需要的时候卸载并重新安装
npm install @angular/Cli @5.2.9
您需要哪个版本。版本
然后在删除项目中的节点模块后,单击
npm install
然后package.json将自动升级到5