前言
- 最近发包时发现npm报错:
The npm registry is deprecating TLS 1.0 and TLS 1.1
。 - 原来以前一直用npm6发包,最低支持到9月份,以下原文:
Detailed timeline
While we will enforce a minimum of TLS 1.2 beginning October 4, 2021, we will also take steps to alert affected users to this change ahead of the deprecation.
Beginning on August 24, users who are not using TLS 1.2 will see a notification when they run npm commands with a link to this blog post.
On September 22, we will enforce TLS 1.2 for one hour starting at 05:00 UTC.
On September 27, we will enforce TLS 1.2 for one hour starting at 10:00 UTC and again for one hour at 18:00 UTC.
Finally, on September 29, we will enforce TLS 1.2 for six hours beginning at 13:00 UTC.
确保兼容性
- 需要运行命令:
npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
- 如果提示:
Hello! The tls-test package was successfully downloaded and installed.
Congratulations! Your package manager appears to support TLS 1.2.
- 说明不用升node,否则node版本也要升级。
- 然后去升级npm7。
升级npm7
- 使用命令:
npm install --global npm
- 中间有可能报错,需要手动删除几个文件。
- 之后运行npm version即可看见升级成功:
{
npm: '7.24.2',
node: '14.15.4',
v8: '8.4.371.19-node.17',
uv: '1.40.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.16.1',
modules: '83',
nghttp2: '1.41.0',
napi: '7',
llhttp: '2.1.3',
openssl: '1.1.1i',
cldr: '37.0',
icu: '67.1',
tz: '2020a',
unicode: '13.0'
}
npm7新特性
- 原文:https://github.blog/2021-02-02-npm-7-is-now-generally-available/