如何卸载纱线?我已经将它用于一个react-native项目,现在每当我将代码移出index.ios.js或index.android.js时,它都会抛出一个错误,所以我只想使用npm,但每当我初始化一个react-native项目时,它默认为yarn。我尝试了npm卸载yarn,但没有工作。谢谢。


当前回答

这是如何为Mac用户完全卸载yarn

sudo npm uninstall -g yarn

其他回答

取决于你如何安装它:

酿造:酿造卸载纱线

tarball: rm -rf "$HOME/.yarn"

Npm: Npm卸载-g yarn

Ubuntu: sudo apt-get remove yarn && sudo apt-get purge yarn

拆纱:拆纱

Windows: choco卸载yarn(或去控制面板>添加/删除程序,并从那里卸载它)

如果你是用npm安装的,试试"npm uninstall -g yarnpkg"(global)或者"npm uninstall yarnpkg"(local)。 这对我来说很有效。 如果仍然不工作,你安装了npm,执行"npm list -g"检查是否全局安装,或"npm list"检查是否本地安装。希望这对有这个问题的人有所帮助。: D

编辑:发现一些东西,如果你安装yarn .msi可执行文件,你必须安装正常的windows方式。

只要复制这个命令,您的问题就会得到解决。

NPM脱纱

Windows:

我需要做这些步骤,以完全去除纱线从系统。

Go to add or remove programs and then search for yarn and uninstall it(if you installed it with the .msi) npm uninstall -g yarn (if you installed with npm) Remove any existing yarn folders from your Program Files (x86) (Program Files (x86)\Yarn). Also need to delete your Appdata\local\yarn folder ( type %LOCALAPPDATA% in the run dialog box (win+R), it opens a local folder and there you'll find the yarn folder to delete) Finally,check your user directory and remove all .yarn folder, .yarn.lock file, .yarnrc etc ( from C:\Users\<user>\)

我发现其他答案有点不充分,因为我想“完全”从我的Mac (M1)上去除纱线。我发现这很有效:

首先,按照安装的方式将其移除,即与此相同。 删除缓存。例如,在我的Mac上,我运行:

rm -rf ~/Library/Caches/Yarn

删除Yarn的全局node_modules缓存:

rm -rf ~/.config/yarn

纱线缓存清理没有帮助摆脱上面哪些工具显着的空间。

删除所有与yarn相关的配置文件:

rm -rf ~/.yarn
rm ~/.yarnrc