Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Uninstall Yarn

How can I uninstall yarn? I've used it for a react-native project and now whenever I move the code out of index.ios.js or index.android.js it throws an error so I'd like to just use npm but whenever I initialize a react-native project it defaults to yarn. I tried npm uninstall yarn but that didn't work. Thanks.

like image 388
maxwellgover Avatar asked Feb 20 '17 01:02

maxwellgover


People also ask

How do you uninstall yarn?

yarn remove <package...> Running yarn remove foo will remove the package named foo from your direct dependencies updating your package. json and yarn. lock files in the process. Other developers working on the project can run yarn install to sync their own node_modules directories with the updated set of dependencies.


2 Answers

Depends on how you installed it:

brew: brew uninstall yarn

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

npm: npm uninstall -g yarn

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

centos: yum remove yarn

windows: choco uninstall yarn (or go to control panel > add/remove programs and uninstall it from there)

like image 179
sospedra Avatar answered Oct 01 '22 23:10

sospedra


Try this, it works well on macOS:

$ brew uninstall --force yarn $ npm uninstall -g yarn $ yarn -v 

v0.24.5 (or your current version)

$ which yarn 

/usr/local/bin/yarn

$ rm -rf /usr/local/bin/yarn $ rm -rf /usr/local/bin/yarnpkg $ which yarn 

yarn not found

$ brew install yarn  $ brew link yarn $ yarn -v 

v1.17.3 (latest version)

Or you could install it as recommended on the website (https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) through npm using:

$ npm install --global yarn 
like image 21
Jan Jarčík Avatar answered Oct 01 '22 23:10

Jan Jarčík