【问题标题】:angular2 quickstart npm install failsangular2 quickstart npm install 失败
【发布时间】:2016-07-16 13:10:39
【问题描述】:

当我尝试运行 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 文件?只是“最近”添加到快速入门中。
  • 我确实创建了它..typings.json
  • 我在快速入门中遇到了同样的错误(手动输入,也来自 git repo)。我安装了节点 4.4.2 和类型 0.7.12。

标签: node.js angular exitstatus


【解决方案1】:

确保您的 npm 版本不是太旧。你可以看看如何升级here

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

npm install -g typings

【讨论】:

    【解决方案2】:

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

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

    终于成功了..

    【讨论】:

      【解决方案3】:

      不是同样的错误,但我遇到了导致 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
      

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

      %HOMEPATH%\.typingsrc

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

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

      【讨论】:

      • 赞成。不确定 HOMEPATH,但文件夹的根目录也可以。
      【解决方案4】:

      确保您已安装 typings 软件包。

      npm install -g typings

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

      您可以关注来自 Angular2 团队的 tutorial

      【讨论】:

      • 我尝试了同样的错误,但仍然是同样的错误。我正在学习相同的教程
      • 您正在运行一个非常旧版本的节点。当前是 v4.4.1。尝试更新你的 nodejs。
      • 尝试像这样将空 json 添加到 typings.json 中:{ }
      猜你喜欢
      • 1970-01-01
      • 2016-01-22
      • 2017-02-07
      • 2019-02-23
      • 2017-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-15
      相关资源
      最近更新 更多