Nodejs always installing 4.2.6

后端 未结 5 1684
终归单人心
终归单人心 2020-12-31 10:41

I am installing latest version of nodejs in my localhost. But system is always installing the 4.2.6 version.How can i install the latest version.

Commands i have use

5条回答
  •  攒了一身酷
    2020-12-31 11:10

    In Linux/Mac systems, there is no better way than nvm - Node Version Manager.

    Install:

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
    

    Then, usage is as simple as:

    nvm install 8.0
    nvm use 8.0
    

    If after reboot you will see old version, use nvm alias to set your version as default one.

提交回复
热议问题