如何正确将Angle 2(npm)升级到最新版本? [英] How do I correctly upgrade angular 2 (npm) to the latest version?

查看:100
本文介绍了如何正确将Angle 2(npm)升级到最新版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我从 https://angular.io/docs/ts/开始了Angular 2教程最新/教程/.

,并从Angular 2 beta 8退出. 现在,我恢复了教程,最新的beta是beta 14.

and left off with Angular 2 beta 8. Now I resumed the tutorial and latest beta is beta 14.

如果我只是简单地 npm更新,则会更新一些模块(随本教程预装),但不会更新Angular2(我可以通过 npm ls 看到它).

If I simply do npm update a few modules (preloaded with the tutorial) are updated but not Angular2 (I can see that with npm ls).

如果我执行 npm update angular 2 npm update angular2@2.0.0beta.14 ,它也无济于事.

If I do npm update angular 2 or npm update angular2@2.0.0beta.14 it just does nothing either.

推荐答案

npm update -D && npm update -S命令会将package.json中的所有软件包更新为最新版本,根据此处中了解更多信息.

The command npm update -D && npm update -S will update all packages inside package.json to their latest version, according to their defined version range. You can read more about it here.

如果要从2.0.0-rc.1之前的版本更新Angular,则需要手动编辑package.json,因为Angular被分为几个npm模块.没有这个,因为 angular2 包指向2.0.0-beta.21,您将永远无法使用最新的Angular版本.
可以在 quickstart存储库中找到包含一些最常用模块的列表. .

If you want to update Angular from a version prior to 2.0.0-rc.1, then you'll need to manually edit package.json, as Angular was split into several npm modules. Without this, as angular2 package points to 2.0.0-beta.21, you'll never get to use the latest version of Angular.
A list with some of the most common modules that you'll need to get started can be found in the quickstart repository.

注释:

  • 一种与软件包最新版本保持同步的很酷的方法是使用 npm outdated ,其中会向您显示所有过时的软件包以及所需的最新版本.

  • A cool way to stay up to date with your packages' latest version is to use npm outdated which shows you all outdated packages together with their wanted and latest version.

我们需要链接两个命令npm update -Dnpm update -S的原因是为了克服

The reason why we need to chain two commands, npm update -D and npm update -S is to overcome this bug until it's fixed.

这篇关于如何正确将Angle 2(npm)升级到最新版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆