yarn link报错
网上翻了一些文章,说 npm link 和 yarn link 都差不多,但是我实际体验下来,yarn link 速度会快一些。
在开发工具包的时候,经常需要在项目中测试工具包的功能是否完善,因此需要在发布版本之前进行本地测试,本地是可以输出一个 package 的,但是太麻烦了,改几行代码又重新打包一次,显然不够优雅,因此需要用到 npm link/yarn link。
在使用 yarn link 的时候报错:
warning There's already a package called "xxx" registered. This command has had no effect. If this command was run in another folder with the same name, the other folder is still linked. Please run yarn unlink in the other folder if you want to register this folder.
1
# 解决办法一
找到之前那个注册为全局链接的文件夹,执行yarn unlink xxx了。
# 解决办法二
不巧的是,我开发的时候,文件夹管理得比较乱,已经找不到原来的文件夹
可以找到 yarn 在系统中的存放软链接的目录,删除这个软链接,具体地址在:C:\Users\lxc\AppData\Local\Yarn\bin和C:\Users\lxc\AppData\Local\Yarn\Data\link
上次更新: 2023/12/16, 09:22:46