Install multiple version of node.js using NVM (Ubuntu)

前端 未结 4 2062
名媛妹妹
名媛妹妹 2021-01-30 07:23

How to install multiple version of node.js in Ubuntu using NVM?

4条回答
  •  遥遥无期
    2021-01-30 07:58

    prior knowledge

    How to use the terminal. You can for example use gnome-terminal.

    Install dependencies

    sudo apt-get install build-essential libssl-dev curl git-core
    

    Install NVM

    Below we will install NVM.

    Download nvm

    git clone git://github.com/creationix/nvm.git ~/.nvm
    

    To activate nvm, you need to source it from your bash shell

    echo "\n. ~/.nvm/nvm.sh" >> .bashrc
    

    Install version of node.js

    In this example I am going to install node v0.4.12. We first need open new bash session. You can also do this by typing bash again.

    $ bash
    $ nvm install v0.4.12 #This takes a while.
    

    To make the latest v0.4 branch default you do

    $ nvm alias default 0.4
    

    Troubleshooting

    When you don't have all dependencies installed you can not compile/install node.js. Then you will need to clean up ~/.nvm

    $ rm -rf ~/.nvm/
    

提交回复
热议问题