换华为的,否则会出问题:cnpm confg set registry https://mirrors.huaweicloud.com/repository/npm/
npm ERR! code CERT_HAS_EXPIRED npm ERR! errno CERT_HAS_EXPIRED npm ERR! request to https://registry.npm.taobao.org/cnpm failed, reason: certificate has expired npm ERR! A complete log of this run can be found in: npm ERR! D:\Users\cj218\AppData\Roaming\npm-cache\_logs\2024-05-29T07_39_17_248Z-debug.log
更新地址
npm install -g cnpm --registry=https://registry.npmmirror.com
注意点:cnpm 要求的 nodejs 最低版本为 14.18.0
Nodejs 升级
下载:https://nodejs.org/en/download/prebuilt-installer
卸载已安装的版本,再安装新版本
下面命令网上找的,不可行,因为在执行的时候,它需要源,但源过期了需要升级,升级需要 Nodejs 高版本。所以死循环
# 查看当前node版本 $ node -v # 清除npm缓存 $ npm cache clean -f # 全局安装n $ npm install -g n # 升级到最新稳定版 $ n stable # 升级到最新版 $ n latest # 升级到定制版 $ n v14.6.0 # 切换使用版本 $ n 13.10.0 (ENTER) # 删除制定版本 $ n rm 13.10.0 # 用制定的版本执行脚本 $ n use 13.10.0 some.js # 升级完成查看 node版本 $ node -v
源替换成功
但又报错了
- [npminstall:get] retry GET https://r.npm.taobao.org/driver.js after 100ms, retry left 4, error: Error: certificate has expired at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34) at TLSSocket.emit (node:events:519:28) at TLSSocket._finishInit (node:_tls_wrap:1085:8) at ssl.onhandshakedone (node:_tls_wrap:871:12) { code: 'CERT_HAS_EXPIRED', name: 'ResponseError', data: undefined, path: '/driver.js', status: -1, headers: {}, res: [Object] }, status: -1, headers: {}, stack: Error: certificate has expired at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34) at TLSSocket.emit (node:events:519:28) at TLSSocket._finishInit (node:_tls_wrap:1085:8) at ssl.onhandshakedone (node:_tls_wrap:871:12) [npminstall:get] retry GET https://r.npm.taobao.org/echarts after 100ms, retry left 4, error: Error: certificate has expired at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34) at TLSSocket.emit (node:events:519:28)
换华为的。
cnpm confg set registry https://mirrors.huaweicloud.com/repository/npm/