且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

代理后面的npm失败,状态为403

更新时间:2023-09-18 16:18:40

好的,所以在发布问题后的几分钟内,我在这里找到答案:
https://github.com/isaacs/npm/issues/2119#issuecomment-5321857

OK, so within minutes after posting the question, I found the answer myself here: https://github.com/isaacs/npm/issues/2119#issuecomment-5321857

问题似乎是npm在代理服务器上使用HTTPS并不是那么好。将注册表URL从HTTPS更改为HTTP为我修复了它:

The issue seems to be that npm is not that great with HTTPS over a proxy. Changing the registry URL from HTTPS to HTTP fixed it for me:

npm config set registry http://registry.npmjs.org/

我仍然需要提供代理配置(在我的情况下通过Authoxy),但一切正常现在。

I still have to provide the proxy config (through Authoxy in my case), but everything works fine now.

似乎是一个常见问题,但没有详细记录。我希望这里的答案能让人们更容易找到他们是否遇到这个问题。

Seems to be a common issue, but not well documented. I hope this answer here will make it easier for people to find if they run into this issue.