问题描述
最近我在 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 [email protected],它也什么都不做.
If I do npm update angular 2 or npm update [email protected] 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 -D
和 npm 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.
这篇关于如何将 angular 2 (npm) 正确升级到最新版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!