npm 使用 https 会报错

查看 68|回复 1
作者:monster1priest   
clash 开的增强模式,终端已设置export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
npm 的 registry 如下设置为 http 时:
registry = "http://registry.npmjs.org/"
可以成功安装,但是会显示warning:
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm 的 registry 换成 https 时:
registry = "https://registry.npmjs.org/"
会报错:
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/@types%2fnode: aborted
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 settings.
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, network, registry

november   
同样,国内使用 https 安装 github 上的项目的时候,也是报错。不过多次安装总有一次成功的。
另外,我用的 yarn ,yarn 打印出 registry 的时候,是 yarn 的地址,但是实际安装却是走的腾讯的源,没找到什么说法。
您需要登录后才可以回帖 登录 | 立即注册

返回顶部