【问题标题】:npm install shows 403 Error on Ubuntu on Windows 10 behind proxynpm install 在代理后面的 Windows 10 上的 Ubuntu 上显示 403 错误
【发布时间】:2020-02-08 15:52:51
【问题描述】:

我在 Windows 10 上使用 ubuntu 来安装和运行 npm。 我使用以下方式下载了nodejs:

curl -sL https://deb.nodesource.com/setup_10.x | bash 
apt-get install -yq nodejs 

我使用以下方法设置代理参数:

npm config set proxy http://my.domain.name:port
npm config set https-proxy http://my.domain.name:port

在执行npm install 时出现以下错误:

...
npm ERR! code E403
npm ERR! 403 Forbidden - GET https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz
npm ERR! A complete log of this run can be found in:  
...

我检查了类似的帖子,但没有任何成功: Using npm behind corporate proxy .pac npm behind a proxy fails with status 403

如果您对此有任何想法,请告诉我,最好

【问题讨论】:

  • npm install -g npm@3.10.10
  • 也没有用...
  • 从 .npmrc 文件中删除 _auth 条目

标签: node.js npm installation http-status-code-403 windows-subsystem-for-linux


【解决方案1】:

试试这个

export https_proxy=http://my.domain.name:port
export http_proxy=http://my.domain.name:port

【讨论】:

  • 让它从 bash 别名导出
  • 这是我的日志文件的结尾:3558 verbose stack Error: 403 Forbidden - GET https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz 3558 verbose stack at res.buffer.catch.then.body (/usr/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:104:15) 3558 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7) 3559 verbose statusCode 403 3560 verbose pkgid acorn@5.7.13562 verbose Linux 4.4.0-18362-Microsoft 3563 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" 3564 verbose node v10.16.3
【解决方案2】:

终于解决了我的问题。我们的管理员定义的代理设置不允许连接到https://registry.npmjs.org/。我必须在我的 Windows 10 代理设置中为该特定地址定义一个例外。 感谢您的帮助

【讨论】:

    猜你喜欢
    • 2016-02-21
    • 2017-06-05
    • 2018-03-12
    • 2014-08-13
    • 1970-01-01
    • 2018-11-21
    • 1970-01-01
    • 2019-11-14
    • 1970-01-01
    相关资源
    最近更新 更多