How to install Angular2 universal when the docs on the site are outdated?

会有一股神秘感。 提交于 2019-12-03 12:52:10

The solution is to install node separately with the --global flag, because it's the only one that needs to be installed globally.

typings install dt~node --global
typings install dt~express dt~body-parser dt~serve-static dt~express-serve-static-core dt~mime

EDIT : You don't need angular universal for server side rendering anymore, as it is now part of angular core.

jamy

As of version 1.0 TypeScript Definition Manager made some updates ([see here][1]) which included deprecating the --ambient flag.

  • Usages of ambient are now global
    • That means in typings.json any ambientDependencies should be renamed globalDependencies and any ambientDevDependencies should be renamed globalDevDependencies.
    • It also means --ambient is now --global ...

=> For more information, check this out. [typings github]: https://github.com/typings/typings [original answer]: Ambient flag is deprecated

Thus, you should use this pattern ↓

typings install dt~PackageName --save --global

ex) typings install dt~body-parser --global --save

Comment below, if you need more help.

With a couple of things changing across typescript and the universal team working overtime to updating universal to the latest releases of angular rc5 and rc6, things have fallen a bit behind on the documentation front. If you want to get started quickly, checkout out the universal starter kit at https://github.com/angular/universal-starter that should work for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!