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

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

    For brew users, OSX:

    To remove:

    brew uninstall node; 
    # or `brew uninstall --force node` which removes all versions
    brew cleanup;
    rm -f /usr/local/bin/npm /usr/local/lib/dtrace/node.d;
    rm -rf ~/.npm;
    

    To install:

    brew install node;
    which node # => /usr/local/bin/node
    export NODE_PATH='/usr/local/lib/node_modules' # <--- add this ~/.bashrc
    

    You can run brew info node for more details regarding your node installs.


    consider using NVM instead of brew

    NVM (node version manager) is a portable solution for managing multiple versions of node

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

    > nvm uninstall v4.1.0
    > nvm install v8.1.2
    > nvm use v8.1.2
    > nvm list
             v4.2.0
             v5.8.0
            v6.11.0
    ->       v8.1.2
             system
    

    you can use this with AVN to automatically switch versions as you hop between different projects with different node dependencies.

提交回复
热议问题