npm install 报错 npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher.
npm install 报错: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/
首先进入所给的网址查看:
查看自己的Node.js和npm版本:
发现版本够高(Node.js最好在18及以上, npm在7及以上)
执行所给代码:
1 | npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz |
重新执行npm install,发现依旧报错
查看设置的npm源:
1 | npm config get registry |
发现源是http://registry.npmjs.org
, 没用https协议, 进行换源
1 | npm config set registry https://registry.npmjs.org |
再次执行npm install, 成功