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


当前回答

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

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

其他回答

在windows的情况下,执行npm uninstall -g yarn后,仍然如果yarn没有卸载,然后转到“C:\Users\username\AppData\Local”并删除yarn文件夹。

关闭cmd并重新打开cmd并执行yarn。它会告诉你“yarn”不是内部或外部命令、可操作程序或批处理文件。

如果你像这样在全球安装纱线

$ sudo npm install -g yarn

在终端中运行即可

$ sudo npm uninstall -g yarn

现在在运行Ubuntu的本地机器上测试。完美的工作!

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用户:

只需使用安装文件(i。e yarn-1.22.4。Msi在我的情况下)卸载纱线。

一旦你打开安装程序,你会得到三个选项,即安装,维修和卸载纱线从你的机器。 选择卸载,它将从你的电脑中删除所有的yarn文件。

ng set——global packageManager=npm或ng set——global packageManager=yarn