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

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

    You can clone https://github.com/brock/node-reinstall and run the simple command as given in the repository.After that just restart your system.
    This is the simplest method and also worked for me.

    0 讨论(0)
  • 2020-11-21 06:07
    • Delete node and/or node_modules from /usr/local/lib

            ex code:
            cd /usr/local/lib
            sudo rm -rf node
            sudo rm -rf node_modules
      
    • Delete node and/or node_modules from /usr/local/include

    • Delete node, node-debug, and node-gyp from /usr/local/bin
    • Delete .npmrc from your home directory (these are your npm settings, don't delete this if you plan on re-installing Node right away)
    • Delete .npm from your home directory
    • Delete .node-gyp from your home directory
    • Delete .node_repl_history from your home directory
    • Delete node* from /usr/local/share/man/man1/
    • Delete npm* from /usr/local/share/man/man1/
    • Delete node.d from /usr/local/lib/dtrace/
    • Delete node from /usr/local/opt/local/bin/
    • Delete node from /usr/local/opt/local/include/
    • Delete node_modules from /usr/local/opt/local/lib/
    • Delete node from /usr/local/share/doc/
    • Delete node.stp from /usr/local/share/systemtap/tapset/
    0 讨论(0)
  • 2020-11-21 06:09

    https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/

    Run following commands to remove node completely from system in MACOS

    sudo rm -rf ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.node_repl_history
    sudo rm -rf /usr/local/bin/npm /usr/local/bin/node-debug /usr/local/bin/node /usr/local/bin/node-gyp
    sudo rm -rf /usr/local/share/man/man1/node* /usr/local/share/man/man1/npm*
    sudo rm -rf /usr/local/include/node /usr/local/include/node_modules
    sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d
    sudo rm -rf /opt/local/include/node /opt/local/bin/node /opt/local/lib/node
    sudo rm -rf /usr/local/share/doc/node
    sudo rm -rf /usr/local/share/systemtap/tapset/node.stp
    
    brew uninstall node
    brew doctor
    brew cleanup --prune-prefix
    



    After this i will suggest to use following command to install node using nvm

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

    from https://github.com/nvm-sh/nvm

    0 讨论(0)
  • 2020-11-21 06:09

    (server: ubuntu 14)

    1.) install nvm (node version manager) https://github.com/creationix/nvm

    2.) nvm install node

    3.) npm -v (inquire npm version => 3.8.6)

    4.) node -v (inquire node version => v6.0.0)

    0 讨论(0)
  • 2020-11-21 06:10

    On Mavericks I install it from the node pkg (from nodejs site) and I uninstall it so I can re-install using brew. I only run 4 commands in the terminal:

    1. sudo rm -rf /usr/local/lib/node_modules/npm/
    2. brew uninstall node
    3. brew doctor
    4. brew cleanup --prune-prefix

    If there is still a node installation, repeat step 2. After all is ok, I install using brew install node

    0 讨论(0)
  • 2020-11-21 06:10

    As a companion to the answers explaining cleanup and install via homebrew, I found that homebrew itself provided clear indications of the symlink clashes.

    Unfortunately it provides these one by one as it encounters them, so it is a little laborious, but it does seem to find all the clashes and was the only way I could get a clean install with homebrew.

    Essentially, the process is:

    1. use homebrew to uninstall node
    2. clean homebrew
    3. use homebrew to install node and note any flagged clashing file
    4. delete the flag clashing file (or whole directory if it is a 'node' directory)
    5. goto step 1 until you get a clean install

    :

    Here is a screen output from the last steps of my install - you can see it results in a clean install (eventually...):

    computer1:DevResources user1$ brew install node
    Updating Homebrew...
    ==> Downloading https://homebrew.bintray.com/bottles/node-13.1.0.mojave.bottle.tar.gz
    Already downloaded: /Users/user1/Library/Caches/Homebrew/downloads/da904f1fdab6f6b2243a810b685e67b29a642c6e945f086e0022323a37fe85f9--node-13.1.0.mojave.bottle.tar.gz
    ==> Pouring node-13.1.0.mojave.bottle.tar.gz
    Error: The `brew link` step did not complete successfully
    The formula built, but is not symlinked into /usr/local
    Could not symlink share/systemtap/tapset/node.stp
    Target /usr/local/share/systemtap/tapset/node.stp
    already exists. You may want to remove it:
      rm '/usr/local/share/systemtap/tapset/node.stp'
    
    To force the link and overwrite all conflicting files:
      brew link --overwrite node
    
    To list all files that would be deleted:
      brew link --overwrite --dry-run node
    
    Possible conflicting files are:
    /usr/local/share/systemtap/tapset/node.stp
    /usr/local/lib/dtrace/node.d
    ==> Caveats
    Bash completion has been installed to:
      /usr/local/etc/bash_completion.d
    ==> Summary
                                                                        
    0 讨论(0)
提交回复
热议问题