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

前端 未结 28 2801
难免孤独
难免孤独 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:25

    I know this post is a little dated but just wanted to share the commands that worked for me in Terminal when removing Node.js.

    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.*
    

    UPDATE: 23 SEP 2016


    If you're afraid of running these commands...

    Thanks to jguix for this quick tutorial.

    First, create an intermediate file:

    lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom >> ~/filelist.txt
    

    Manually review your file (located in your Home folder)

     ~/filelist.txt
    

    Then delete the files:

    cat ~/filelist.txt | 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.*
    

    For 10.10.5 and above

    Thanks Lenar Hoyt

    Gist Comment Source: gistcomment-1572198

    Original Gist: TonyMtz/d75101d9bdf764c890ef

    lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.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.*
    

提交回复
热议问题