10

当我尝试运行 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.

我该如何解决这个问题?

4

4 回答 4

13

确保您已typings安装软件包。

npm install -g typings

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

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

于 2016-03-29T06:06:19.563 回答
4

不是同样的错误,但是我遇到了导致typings install失败的代理问题:如果您遇到代理问题,npm那么您也将遇到代理问题typings

我得到的错误是:

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

typings我通过在我的文件夹中创建一个设置文件来解决这个问题%HOMEPATH%

%HOMEPATH%\.typingsrc

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

有关详细信息,请参阅这些链接:第一个建议将.typingsrc文件放在项目文件夹中,但您可以使用主文件夹,如npm.

于 2016-07-20T06:11:40.143 回答
0

我在公司代理后面,我只是尝试使用以下内容创建一个文件 .typingsrc 并放在我的应用程序的根文件夹中

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

终于成功了。。

于 2016-10-13T22:29:55.950 回答
0

确保您的 npm 版本不太旧。您可以在此处查看如何升级。

有了新的 npm 版本后,安装 typings 包:

npm install -g typings
于 2017-03-22T14:03:19.017 回答