将 Angular 4.x 迁移到 Angular 5 [英] Migrating Angular 4.x to Angular 5
问题描述
我已阅读以下博客和文档
I have read the following blogs and documentation
并且没有关于如何从 4.x 迁移到 5 的明确信息.
and no clear information about how to migrate from 4.x to 5.
尝试了以下命令
npm 安装
npm install
npm install @angular/{animations,common,compiler,compiler-cli,
core,forms,http,platform-browser,platform-browser-dynamic,
platform-server,router}@5.0.0
纱线安装
yarn installation
yarn add @angular/{animations,common,compiler,compiler-cli,
core,forms,http,platform-browser,platform-browser-dynamic,
platform-server,router}@5.0.0
尝试了更新指南
npm install @angular/animations@'^5.0.0' @angular/common@'^5.0.0'
@angular/compiler@'^5.0.0' @angular/compiler-cli@'^5.0.0'
@angular/core@'^5.0.0' @angular/forms@'^5.0.0'
@angular/http@'^5.0.0' @angular/platform-browser@'^5.0.0'
@angular/platform-browser-dynamic@'^5.0.0'
@angular/platform-server@'^5.0.0' @angular/router@'^5.0.0'
typescript@2.4.2 rxjs@'^5.5.2'
npm install typescript@2.4.2 --save-exact
没有什么对我有用.请帮忙
Nothing worked fine for me. Please help
推荐答案
您需要将所有 angular 提供的包更新到最新版本,如下所示:
You need to update all angular provided packages to their latest versions as follows:
npm install typescript@2.4 --save-dev
npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest --save
这应该完成所有必要的工作.另外,您还可以更新 angular 5 附带的 angular cli 作为标准版本,如下所示:
This should do all the necessary. Plus you could also update your angular cli that ships with angular 5 as standard version as follows:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
这是 Angular 团队的官方博文:https://angular-update-guide.firebaseapp.com/.本更新指南将帮助您从任何版本迁移到最新版本.
Here is the official blogpost by Angular team : https://angular-update-guide.firebaseapp.com/. This update guide will help you to migrate from any version to the latest one.
这篇关于将 Angular 4.x 迁移到 Angular 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!