Angular2升级到Angular4

Angular4终于在两天前发布了正式版本,那么怎么升级呢?其实Angular2和Angular4之间属于平滑过渡,并不像1和2之间颠覆性的重写代码。

  1. 使用npm-check方案升级 使用如下命令检查,并按下空格来选择要升级的包
    npm-check -u
    
  2. 官方推荐
    1. 升级cli
     npm uninstall -g @angular/cli
     npm cache clean
     npm install -g @angular/cli@latest
    
     rm -rf node_modules dist # 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
    
    1. 升级包
     // linux/mac
     npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@latest typescript@latest --save
     // Windows
     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 typescript@latest --save
    
    1. 更换一些其他包
     npm install [email protected] --save
    
    1. 执行安装命令
     npm install
    

一些AngularJS相关文章链接

希望你喜欢,并分享我的工作~带你走近AngularJS系列

  1. 带你走近AngularJS - 基本功能介绍 http://www.linuxidc.com/Linux/2014-05/102140.htm
  2. 带你走近AngularJS - 体验指令实例 http://www.linuxidc.com/Linux/2014-05/102141.htm
  3. 带你走近AngularJS - 创建自定义指令 http://www.linuxidc.com/Linux/2014-05/102142.htm

AngularJS 的详细介绍请点这里
AngularJS 的下载地址请点这里

猜你喜欢

转载自www.linuxidc.com/Linux/2017-03/142315.htm