npm i安装依赖的时候出现报错,翻译软件翻译过来就是:
“从2021 10月4日开始,与npm注册表的所有连接(包括用于安装软件包的连接)必须使用TLS 1.2或更高版本。您当前正在使用明文http连接”
1、查看本地npm是不是官方的
npm config get registry
2、设置npm官方源
npm config set registry https://registry.npmjs.org
然后再安装就成功了
bogon:h5 dongxiao$ npm config get registry
http://registry.npmjs.org/
bogon:h5 dongxiao$ npm config set registry https://registry.npmjs.org
validBefore? true
bogon:h5 dongxiao$ npm config get registry
https://registry.npmjs.org/