关于vue创建项目失败报错(镜像过期)的解决方案

在新建vue项目时出现以下错误:

原因:
npm.taobao.orgregistry.npm.taobao.org旧域名于2021年官方公告域名更换事件,已于2022年05月31日零时起停止服务,域名HTTPS证书于2024年1月22日正式到期,不可再用。

解决方案:

使用以下命令查看已有镜像:

c 复制代码
npm config get

再修改对应镜像源:

c 复制代码
npm config set registry https://registry.npmjs.org

到此已成功更换镜像源,但是在重新创建vue项目时,依旧走的是旧的镜像。所以还需要修改以下自己的vue-cli的配置。文件位置在:

复制代码
 C:\Users\TT\AppData\Roaming\npm\node_modules\@vue\cli\lib\util\registries.js 

修改registries.js 文件的内容,覆盖为:

js 复制代码
const registries = {
 npm: 'https://registry.npmjs.org',
 yarn: 'https://registry.yarnpkg.com',
 taobao: 'https://registry.npmmirror.com/',
 pnpm: 'https://registry.npmjs.org'
}
module.exports = registries

保存,再次创建项目即可。

!

相关推荐
jay神8 小时前
基于Java的水果网上订购平台
java·mysql·vue·springboot·计算机毕业设计
午安~婉1 天前
整理知识点
前端·javascript·vue
ggaofeng1 天前
实践NPM打包和使用
前端·npm·node.js
ggaofeng1 天前
理解npm的原理
前端·npm·node.js
Shi_haoliu2 天前
SolidTime 在 Rocky Linux 9.5 上的完整部署流程
linux·运维·nginx·postgresql·vue·php·laravel
Mast Sail2 天前
WebStrom+Vitesse+Vue3项目路径报错爆红问题
vue·vite·webstorm
中年程序员一枚2 天前
nuxt安装出现certificate 错误
前端框架·npm·node.js
全栈前端老曹3 天前
【前端】Hammer.js 快速上手入门教程
开发语言·前端·javascript·vue·react·移动端开发·hammer.js
response_L3 天前
PageOffice动态给word插入二维码(或条形码)图片
vue·word·开发工具·二维码·在线编辑
华玥作者3 天前
uni-app + Vite 项目中使用 @uni-helper/vite-plugin-uni-pages 实现自动路由配置(超详细)
前端·uni-app·vue·vue3·vite