当网站上的文档已过期时,如何安装Angular2?

angular2-universal的维护人员没有更新他们的网站:

问题1)

typings install node express body-parser serve-static express-serve-static-core mime --ambient typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead 

问题2)

  typings install node express body-parser serve-static express-serve-static-core mime --global typings INFO globaldependencies "express" lists global dependencies on "node" that must be installed manually typings INFO globaldependencies "body-parser" lists global dependencies on "node" that must be installed manually typings ERR! message Unable to find "node" ("npm") in the registry. typings ERR! message However, we found "node" for 2 other sources: "dt" and "env" typings ERR! message You can install these using the "source" option. typings ERR! message We could use your help adding these typings to the registry: https://github.com/typings/registry typings ERR! caused by https://api.typings.org/entries/npm/node/versions/latest responded with 404, expected it to equal 200 typings ERR! cwd /Users/davidmontgomery/Documents/frontend/green typings ERR! system Darwin 15.6.0 typings ERR! command "/usr/local/bin/node" "/usr/local/bin/typings" "install" "node" "express" "body-parser" "serve-static" "express-serve-static-core" "mime" "--global" typings ERR! node -v v4.5.0 typings ERR! typings -v 1.3.3 typings ERR! If you need help, you may report this error at: typings ERR! <https://github.com/typings/typings/issues> 

我该如何解决? 我正在使用一个mac。

解决方法是使用--global标志单独安装节点,因为它是唯一需要全局安装的节点。

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

编辑:你不需要angular度通用的服务器端渲染了,因为它现在是angular核心的一部分。

从版本1.0开始,TypeScript定义pipe理器进行了一些更新([see here] [1]),其中包括废弃--ambient标志。

  • 环境的使用现在是全球性的
    • 这意味着在typings.json任何ambientDependencies都应该被重命名为globalDependencies并且任何ambientDevDependencies都应该被重命名为globalDevDependencies
    • 这也意味着 – --ambient现在是 – --global

=>有关更多信息,请查看。 [typings github]: https : //github.com/typings/typings [原创]: 环境标志被弃用

因此,你应该使用这种模式↓

typings install dt~PackageName --save --global

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

下面评论,如果你需要更多的帮助。

随着打字稿和通用团队加class加点地更新通用版到angular度rc5和rc6的最新版本,情况有所改变,事情在文档方面已经落后了一些。 如果您想快速入门, 请通过https://github.com/angular/universal-starter查看适用于您的通用入门套件&#x3002;