How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

前端 未结 28 2264
难免孤独
难免孤独 2020-11-21 05:28

My version of node is always v0.6.1-pre even after I install brew node and NVM install v0.6.19.

My node version is:



        
28条回答
  •  心在旅途
    2020-11-21 06:11

    1. First:

      lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do  sudo rm /usr/local/${f}; done
      
      sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
      
    2. To recap, the best way (I've found) to completely uninstall node + npm is to do the following:

      go to /usr/local/lib and delete any node and node_modules

      cd /usr/local/lib
      
      sudo rm -rf node*
      
    3. go to /usr/local/include and delete any node and node_modules directory

      cd /usr/local/include
      
      sudo rm -rf node*
      
    4. if you installed with brew install node, then run brew uninstall node in your terminal

      brew uninstall node
      
    5. check your Home directory for any "local" or "lib" or "include" folders, and delete any "node" or "node_modules" from there

      go to /usr/local/bin and delete any node executable

      cd /usr/local/bin
      
      sudo rm -rf /usr/local/bin/npm
      
      ls -las
      
    6. You may need to do the additional instructions as well:

      sudo rm -rf /usr/local/share/man/man1/node.1
      
      sudo rm -rf /usr/local/lib/dtrace/node.d
      
      sudo rm -rf ~/.npm
      

    Source: tonyMtz

提交回复
热议问题