【问题标题】:Unable to install npm under corporate proxy无法在公司代理下安装 npm
【发布时间】:2016-07-25 19:19:51
【问题描述】:

我已经尝试了此链接中给出的所有内容:

Using npm behind corporate proxy .pac

但是我还是无法安装 webpack 和 babel。

有人告诉我,如果我从 nodejs 获得 npm,那么我需要修改我的路径以避免使用那个路径。默认情况下,npm 将转到C:\Users\username\xxxx。所以,我将路径更新为:%PATH%;C:\Users\username\xxxx;C:\util\nodejs。但我在路径 C:\Users\username\xxx 下只有一个空的 npm 文件夹,它仍然只从 nodejs 读取 npm。

即使npm install npm -g 也无法正常工作(同样的代理错误)。

【问题讨论】:

    标签: node.js proxy npm babeljs


    【解决方案1】:

    使用设置代理: npm 配置设置 https-proxy http://your_proxy_ip:port

    检查 npm config list 或 npm config get registry

    如果返回: 注册表=“http://registry.npmjs.org/

    然后运行命令: npm config 设置注册表https://registry.npmjs.org/

    现在尝试运行: npm 安装

    然后运行: npm 开始

    它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-27
      • 1970-01-01
      • 2019-11-28
      • 1970-01-01
      • 2016-03-08
      • 1970-01-01
      • 2014-10-28
      相关资源
      最近更新 更多