How to install a specific version of Node on Ubuntu?

前端 未结 14 732
Happy的楠姐
Happy的楠姐 2020-12-07 12:52

I would like to install NodeJS version 0.8.18 on Ubuntu 12.04. I tried to install the newest version and then reverting to 0.8.18 by using nvm, but when I run m

14条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 13:34

    Install nvm using the following commands in the same order.nvm stands for node version manager.

    sudo apt-get update
    sudo apt-get install build-essential checkinstall libssl-dev
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
    

    In case the above command does not work add -k after -o- .It should be as below:

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

    Then nvm ls-remote to see the available versions. In case you get N/A in return,run the following.

    export NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist
    

    alternatively you can run the following commands too

    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This         loads nvm bash_completion
    

    Then nvm install #.#.# replacing # by version(say nvm 8.9.4) finally nvm use #.#.#

提交回复
热议问题