当前位置: 首页>后端>正文

Vue npm install --save moment 安装失败

问题

npm install --save moment 安装失败

解决

  • 使用 yarn add moment 安装
  yarn add moment
Vue npm install --save moment 安装失败,第1张
  • 报了个 "https://registry.npm.taobao.org/regenerator-runtime: certificate has expired 错误,表明证书过期了。
yarn add v1.22.19
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] Validating package.json...
[2/5] Resolving packages...
error An unexpected error occurred: "https://registry.npm.taobao.org/regenerator-runtime: certificate has expired".
info If you think this is a bug, please open a bug report with the information provided in "D:\项目\2023年\*****\front\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
  • 我们需要切换淘宝最新镜像地址
npm config set registry https://registry.npmmirror.com
  • 再次执行,可见成功安装


    Vue npm install --save moment 安装失败,第2张

补充

  • 其它镜像源
npm 官方原始镜像网址是:https://registry.npmjs.org/
淘宝最新 NPM 镜像:https://registry.npmmirror.com
阿里云 NPM 镜像:https://npm.aliyun.com
腾讯云 NPM 镜像:https://mirrors.cloud.tencent.com/npm/
华为云 NPM 镜像:https://mirrors.huaweicloud.com/repository/npm/
网易 NPM 镜像:https://mirrors.163.com/npm/
中科院大学开源镜像站:http://mirrors.ustc.edu.cn/
清华大学开源镜像站:https://mirrors.tuna.tsinghua.edu.cn/
腾讯,华为,阿里的镜像站基本上比较全

https://www.xamrdz.com/backend/3qq1937962.html

相关文章: