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


当前回答

没有看到对我有用的答案,所以它是:在我的OSX系统上,我在~/.yarn/bin/yarn找到了yarn。Rm -rf ~/。纱处理了它。

其他回答

在我的Mac上,这两种常规方法都不能卸载Yarn:

酿造:酿造卸载纱线

Npm: Npm卸载-g yarn

相反,我手动删除它输入rm -rf ~/。Yarn(感谢用户elthrasher)并删除usr/local/bin中的Yarn和yarnpkg两个符号。 之后酝酿安装yarn给了我最新版本的yarn。


背景:事实上,我安装了一个非常过时的Yarn版本,当我试图安装额外的模块到一个用Vue CLI Service和Vue UI设置的项目时,我犯了完全无法理解的错误,而Vue CLI Service和Vue UI显然在“底层”使用了Yarn。我通常使用NPM,所以我花了一段时间来找出我的问题的原因。当然,谷歌这种模块不兼容所产生的错误消息并没有提供任何线索。随着Yarn的更新,现在一切都很完美。

我尝试了sospedra发布的Homebrew和tarball points。这还不够。

我发现yarn安装在~/.config/yarn/global/node_modules/yarn

我跑纱线全球除去纱线。重新启动终端,它消失了。

最初,我来这里是因为yarn恢复到旧版本,但我不知道为什么,尝试卸载或升级失败。

当我检出某个项目的旧分支时,使用的yarn版本从1.9.4变成了0.19.1。

即使在采取步骤去除纱线后,它仍然保持在0.19.1。

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>\)

我无法在windows上卸载yarn,我尝试了这里的每一个答案,但每次我运行yarn -v时,该命令都有效。但后来我意识到还有一件事会影响这一点。

如果你在windows上(不确定在mac上是否也会发生这种情况)并使用nvm,可能发生的一个问题是你已经安装了nvm而没有卸载npm,并且working yarn命令来自旧npm的旧yarn版本。

所以你需要做的是遵循nvm文档中的这一步

你还应该删除现有的npm安装位置(例如:"C:\Users<user>\AppData\Roaming\npm"),这样nvm安装位置将被正确使用。备份全局npmrc配置(例如C:\Users&lt;user>\AppData\Roaming\npm\etc\npmrc),如果那里有一些重要的设置,或将设置复制到用户配置C:\Users&lt;user>.npmrc。

为了确认你的问题是旧的npm,你可能会看到yarn。C:\Users\<user>\AppData\Roaming\npm文件夹中的cmd文件。

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

sudo npm uninstall -g yarn