【问题标题】:angular-cli globally installation failureangular-cli 全局安装失败
【发布时间】:2018-05-15 18:53:59
【问题描述】:

我正在尝试全局安装angular-cli,但出现这些错误。该怎么办?

C:\Users\Jahidul>npm install -g angular-cli

npm WARN registry Using stale data from http://registry.npmjs.org/ because the h
ost is inaccessible -- are you offline?

npm WARN deprecated angular-cli@1.0.0-beta.28.3: angular-cli has been renamed to
 @angular/cli. Please update your dependencies.

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher
 to avoid a RegExp DoS issue

npm ERR! code ENOTFOUND

npm ERR! errno ENOTFOUND

npm ERR! network request to http://registry.npmjs.org/micromatch failed, reason:
 getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:8080

npm ERR! network This is a problem related to network connectivity.

npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.

npm ERR! network

npm ERR! network If you are behind a proxy, please make sure that the

npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\Jahidul\AppData\Roaming\npm-cache\_logs\2017-06-30T14_57_5
6_218Z-debug.log

【问题讨论】:

    标签: angularjs node.js npm


    【解决方案1】:

    如果你按照this site中提到的指令,你会发现命令

    npm install -g angular-cli
    

    应该替换为

    npm install -g @angular/cli
    

    错误中也提到了这一点。使用新命令重试。

    【讨论】:

    • 现在出现这些错误 C:\Users\Jahidul>npm install -g @angular/cli npm ERR!代码 EAI_AGAIN npm 错误! errno EAI_AGAIN npm 错误!对registry.npmjs.org/@angular%2fcli 的请求失败,原因:获取 addrinfo EAI_AGAIN registry.npmjs.org:8080 npm ERR!可以在以下位置找到此运行的完整日志:npm ERR! C:\Users\Jahidul\AppData\Roaming\npm-cache_logs\2017-06-30T15_36_0 4_880Z-debug.log
    • @JahidPathan -- 请张贴C:\Users\Jahidul\AppData\Roaming\npm-cache_logs\2017-06-30T1‌​5_36_0 4_880Z-debug.log中的内容!
    【解决方案2】:

    问题是我的互联网连接不稳定。现在一切正常。

    【讨论】:

      【解决方案3】:

      如果您遇到相同的错误并且您位于公司网络后面,那么您需要更改配置以添加代理,如下所示:

      1. 在命令提示符中转到 node.js 安装位置并键入以下命令:

        npm config edit --g

      2. 在文件末尾添加以下行: registry=http://registry.npmjs.org/ strict-ssl=false proxy=http://proxy.YOURCOMPANYNAME.com:8080

      3. 然后执行 npm install 命令: npm install -g @angular/cli@latest

      【讨论】:

        猜你喜欢
        • 2017-02-14
        • 1970-01-01
        • 1970-01-01
        • 2016-10-21
        • 2012-11-11
        • 2018-05-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多