How to install Angular2 universal if the documents on the site are out of date?

Supporters of angular2 -universal have not updated their site:

Problem 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 

Task 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> 

How do i allow it? I am using mac.

+6
source share
3 answers

The solution is to install node separately with the --global flag, because it is 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 will no longer need angular universal for server-side processing, as it is now part of the angular core.

+16
source

Starting with version 1.0 of TypeScript, the Definition Manager has made some updates ([see here] [1]), which included the rejection of the --ambient flag.

  • Ambient use is now global
    • This means that in typings.json any ambientDependencies should be renamed globalDependencies , and any ambientDevDependencies should be renamed globalDevDependencies .
    • It also means that --ambient now --global ...

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

So you should use this template ↓

typings install dt~PackageName --save --global

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

Comment below if you need further help.

0
source

With a few things that change through typescript and a universal team working overtime to update universal versions to the latest versions of angular rc5 and rc6, things went a bit on the front of the documentation. If you want to get started quickly, check out the universal starter kit https://github.com/angular/universal-starter , which should work for you.

0
source

All Articles