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

Tam*_*mpa 8 javascript node.js angular2-universal angular

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
Run Code Online (Sandbox Code Playgroud)

问题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>
Run Code Online (Sandbox Code Playgroud)

我该如何解决?我正在使用mac.

Gui*_*ère 18

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

typings install dt~node --global
typings install dt~express dt~body-parser dt~serve-static dt~express-serve-static-core dt~mime
Run Code Online (Sandbox Code Playgroud)

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


jam*_*amy 0

从 1.0 版开始,TypeScript 定义管理器进行了一些更新([参见此处][1]),其中包括弃用该--ambient标志。

\n\n
\n
    \n
  • 环境的使用现在是全局的\n \n
      \n
    • 这意味着 in typings.jsonanyambientDependencies应该重命名globalDependencies,而 anyambientDevDependencies应该重命名globalDevDependencies。
    • \n
    • 这也意味着--ambient现在--global\n ...
    • \n
  • \n
\n
\n\n

=> 有关更多信息,请查看此内容。 \n [typings github]:https://github.com/typings/typings \n [原始答案]:环境标志已弃用

\n\n

因此,您应该使用此模式 \xe2\x86\x93

\n\n

typings install dt~PackageName --save --global

\n\n

前任)typings install dt~body-parser --global --save

\n\n

如果您需要更多帮助,请在下面评论。

\n