How Do I Uninstall Yarn

前端 未结 19 1164
醉话见心
醉话见心 2020-12-22 17:45

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 thro

相关标签:
19条回答
  • 2020-12-22 18:24

    npm uninstall yarn removes the yarn packages that are installed via npm but what yarn does underneath the hood is, it installs a software named yarn in your PC. If you have installed in Windows, Go to add or remove programs and then search for yarn and uninstall it then you are good to go.

    0 讨论(0)
  • 2020-12-22 18:25

    In case you installed yarn globally like this

    $ sudo npm install -g yarn
    

    Just run this in terminal

    $ sudo npm uninstall -g yarn
    

    Tested now on my local machine running Ubuntu. Works perfect!

    0 讨论(0)
  • 2020-12-22 18:28

    I couldn't uninstall yarn on windows and I tried every single answer here, but every time I ran yarn -v, the command worked. But then I realized that there is another thing that can affect this.

    If you on windows (not sure if this also happens in mac) and using nvm, one problem that can happen is that you have installed nvm without uninstalling npm, and the working yarn command is from your old yarn version from the old npm.

    So what you need to do is follow this step from the nvm docs

    You should also delete the existing npm install location (e.g. "C:\Users<user>\AppData\Roaming\npm"), so that the nvm install location will be correctly used instead. Backup the global npmrc config (e.g. C:\Users&lt;user>\AppData\Roaming\npm\etc\npmrc), if you have some important settings there, or copy the settings to the user config C:\Users&lt;user>.npmrc.

    And to confirm that you problem is with the old npm, you will probably see the yarn.cmd file inside the C:\Users\<user>\AppData\Roaming\npm folder.

    0 讨论(0)
  • 2020-12-22 18:31

    What I've done on my side:

    Went to the /usr/local/lib/node_modules, and deleted the yarn folder inside it.

    0 讨论(0)
  • 2020-12-22 18:31

    I had to manually remove(delete) the Yarn folder from drive and then run npm uninstall -g yarn again to reinstall it. It worked for me.

    0 讨论(0)
  • 2020-12-22 18:31

    If you are still getting errors after deleting ~/.yarn about files not being found, don't forget to delete the yarn rc file:

    rm ~/.yarnrc.yml 
    
    0 讨论(0)
提交回复
热议问题