angular2 quickstart npm安装失败

当我尝试运行-npm install时出现以下错误。 错误如下:

npm ERR! node v0.12.12 npm ERR! npm v3.3.6 npm ERR! code ELIFECYCLE npm ERR! angular2-quickstart@1.0.0 postinstall: `typings install` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the angular2-quickstart@1.0.0 postinstall script 'typings ins tall'. npm ERR! This is most likely a problem with the angular2-quickstart package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! typings install npm ERR! You can get their info via: npm ERR! npm owner ls angular2-quickstart npm ERR! There is likely additional logging output above. 

我如何解决这个问题?

确保你已经安装了typings包。

npm install -g typings

还要确保你有typings.json文件可用。

您可以从Angular2团队中按照本教程进行操作。

不是一样的错误,但我有一个代理问题,导致typestypings install失败:如果你有一个代理问题的npm那么你也将有types的代理问题。

我得到的错误是:

 typings ERR! message Unable to connect to "https://api.typings.org/entries/dt/selenium-webdriver/tags/2.44.0%2B20160317120654" typings ERR! caused by connect ECONNREFUSED 104.24.112.177:443 

我通过在我的%HOMEPATH%文件夹中创buildtypes设置文件来解决此问题:

%HOMEPATH%\。typingsrc

 proxy=http://DOMAIN%5Cusername:password@proxy:port/ https-proxy=http://DOMAIN%5Cusername:password@proxy:port/ rejectUnauthorized=false 

看到这些链接的更多细节:第一个build议把.typingsrc文件放到你的项目文件夹中,但是你可以使用像npm这样的home文件夹。

我背后的公司代理,我刚刚尝试创build一个文件.typingsrc与下面的内容,并放在我的应用程序的根文件夹

 { "proxy":"http://proxy-server:8080", "rejectUnauthorized": false } 

它终于工作了..

确保你没有太旧的npm版本。 你可以看到如何在这里升级。

在你有一个新的npm版本之后,安装打字包:

 npm install -g typings