Angular 在现有 angular 2 个应用程序上使用 cli 进行通用安装

Angular universal installation on existing angular 2 app using cli

我在按照下面 link 的说明在现有 angular 2 应用程序上实施通用 cli 时遇到了一些问题 https://universal.angular.io/quickstart/

关于第一个命令安装angular-universal

npm install body-parser angular2-universal preboot express --save

我收到以下错误

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'C:\test-app\node_modules\node_modules\package.json'
npm WARN angular2-universal@2.1.0-rc.1 requires a peer of zone.js@~0.6.21 but none was installed.
npm WARN angular2-universal-polyfills@2.1.0-rc.1 requires a peer of zone.js@~0.6.21 but none was installed.

执行第二个命令后,我遇到了下面列出的错误

/ Resolving "express" from "https://raw.githubusercontent.com/types/npm-express/40186271a77cdfad17681014be3ea8b05fc8dcf…- Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…\ Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…| Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…/ Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…- Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…\ Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…| Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…/ Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…- Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…\ Resolving "mime" from "https://raw.githubusercontent.com/types/npm-mime/c7c5810698b7eaa421702a53644a8963d372f758/typi…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!
typings ERR! cwd C:\test-app
typings ERR! system Windows_NT 10.0.14393
typings ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Ajackus Consultancy\AppData\Roaming\npm\node_modules\typings\dist\bin.js" "install" "node" "express" "body-parser" "serve-static" "express-serve-static-core" "mime" "--global"
typings ERR! node -v v4.6.0
typings ERR! typings -v 2.1.0
typings ERR!
typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>

我错过了什么?

没什么,这些是警告,不是错误。您很可能可以安全地忽略这些。当依赖项安装在依赖项之后时,就会发生这种情况。

typings 的用法有点不赞成使用 @types。而不是执行这些命令,并删除您的本地打字文件夹:

npm install --save-dev @types/node 
npm install --save-dev @types/express 
npm install --save-dev @types/body-parser 
npm install --save-dev @types/serve-static 
npm install --save-dev @types/express-serve-static-core 
npm install --save-dev @types/mime