柚子快报激活码778899分享:前端 npm中遇到的问题
npm问题
npm ERR! code CERT_HAS_EXPIRED 证书过期问题
通过npm的vue/cli脚手架创建vue项目时,发现如下错误
此问题是由于node.js和npm报出的错误,意思为:正在访问的服务器的ssl证书已过期
解决方案
# 清除npm的缓存
npm cache clean --force
# 取消ssl验证
npm config set strict-ssl false
如果此方案解决不了,可以尝试换镜像源
# 淘宝源 此源于2022年5月31日已被废弃
npm config set registry https://registry.npm.taobao.org/
# 新的淘宝源
npm config set registry https://registry.npmmirror.com/
# 官方中国源
npm config set registry https://registry.npmjs.com.cn/
# cnpm源
npm config set registry http://r.cnpmjs.org/
# 阿里巴巴源
npm config set registry https://npm.aliyun.com/
# 七牛云源
npm config set registry https://npm.qiniu.com/
npm下载卡在/ reify:@dcloudio/uni-ui: http fetch GET 200 https://cdn.npmmirror.com/packages/%40dcloudio/uni-ui/1.5.5/uni-ui-1.5.5.tgz 1146ms (cache miss)
原因:因为npm默认是淘宝的镜像源,淘宝镜像源有一些问题所以不行,这里可以换成pnpm或者cnpm
npm install cnpm -g
npm install pnpm -g
更换npm镜像源
# 查看当前的源
npm config ls
# 在上面命令的结果有,有下面一行,该行记录的网站就是我们安装第三方模块的网站
# registry = "https://registry.npmjs.org/"
# 下载包的时候切换源
npm install express --registry=https://registry.npm.taobao.org
# 全局设置
npm config set registry https://registry.npm.taobao.org
# 原始的路径
# https://registry.npmjs.org/
# nrm 是管理镜像源的模块,通过nrm来管理镜像源
npm i nrm # 自行查询如何使用
# 查看当前源
npm config get registry
# 淘宝源 此源于2022年5月31日已被废弃
npm config set registry https://registry.npm.taobao.org/
# 新的淘宝源
npm config set registry https://registry.npmmirror.com/
# 官方中国源
npm config set registry https://registry.npmjs.com.cn/
# cnpm源
npm config set registry http://r.cnpmjs.org/
# 阿里巴巴源
npm config set registry https://npm.aliyun.com/
# 七牛云源
npm config set registry https://npm.qiniu.com/
柚子快报激活码778899分享:前端 npm中遇到的问题
推荐阅读
发表评论