解决yarn run dev报错: TypeError: Cannot create property ‘-registry-npmmirror-com‘
一、问题描述
在使用yarn run dev
启动项目时,遇到以下错误:
error TypeError: Cannot create property '-registry-npmmirror-com' on string '{"-registry-npmmirror-com":true}'
二、解决方案
使用npm config get registry
和yarn config get registry
查看镜像源:
设置新的镜像源:
可以参考之前的文章《NPM设置国内不同镜像》
npm config set registry https://registry.npmmirror.com
或者使用命令进行修改:
npm config edit
但修改后仍没有解决问题:
于是检查配置文件:打开项目根目录或用户目录下的 .yarnrc 和 .npmrc 文件,检查是否有以下内容:
将"registry=https://registry.npmmirror.com" true
删除即可。