npm,yarn,vue cli如何查看源和换源,删除node_modules

本文介绍了如何在npm和yarn中查看并设置镜像源,以及解决在Vue项目中遇到的vue-cli版本获取错误,包括卸载、清理缓存和重新安装vue-cli的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

npm, yarn查看源和换源:

npm config get registry // 查看npm当前镜像源

npm config set registry https://registry.npmmirror.com // 设置npm镜像源为淘宝镜像

yarn config get registry // 查看yarn当前镜像源

yarn config set registry https://registry.npmmirror.com // 设置yarn镜像源为淘宝镜像

macOS、Linux 系统可以使用 rm 命令进行删除。

rm -r node_modules

在vue中创建vue-demo提示源错误

vue create vue-demo
❌ERROR Failed to get response from https://registry.npm.taobao.org/vue-cli-version-marker

解决方案:卸载vue cli,替换npm 的源,再npm install -g @vue/cli

npm uninstall -g @vue/cli
npm cache clean --force
npm install -g @vue/cli

参考链接:https://blog.csdn.net/HermitSun/article/details/104524141

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值