How to install a specific version of Node on Ubuntu?

前端 未结 14 668
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

    FYI the available version for raring in Chris Lea's repo is currently 0.8.25

    sudo apt-get install nodejs=0.8.25-2chl1~raring1

    0 讨论(0)
  • 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 #.#.#

    0 讨论(0)
  • 2020-12-07 13:39

    version 0.10 is also avaible with this ppa

    apt-add-repository ppa:chris-lea/node.js
    

    install nodejs with:

    apt-get install nodejs=0.10.25-1chl1~precise1
    

    Thanks to my friend Julian Xhokaxhiu

    0 讨论(0)
  • 2020-12-07 13:41

    It is possible to install specific version of nodejs from nodejs official distribution with using dpkg.

    • Check the version of you ubuntu distribution, cat /etc/lsb-release.
    • Check architecture of your os, uname -m.
    • Download preferred version of debian package from nodejs official site.
      • For 4.x, https://deb.nodesource.com/node_4.x/pool/main/n/nodejs/
      • For 5.x, https://deb.nodesource.com/node_5.x/pool/main/n/nodejs/
      • For 0.12.x, https://deb.nodesource.com/node_0.12/pool/main/n/nodejs/
    • Be careful to check nodejs-dbg or nodejs in filename.

    For example, currently recent 4.x version is 4.2.4, but you can install previous 4.2.3 version.

    curl -s -O https://deb.nodesource.com/node_4.x/pool/main/n/nodejs/nodejs_4.2.3-1nodesource1~trusty1_amd64.deb
    sudo apt-get install rlwrap
    sudo dpkg -i nodejs_4.2.3-1nodesource1~trusty1_amd64.deb
    
    0 讨论(0)
  • 2020-12-07 13:44

    Chris Lea has 0.8.23 in his ppa repo.

    This package let you add a repository to apt-get: (You can also do this manually)

    sudo apt-get install software-properties-common
    

    Add Chris Lea's repository:

    sudo apt-add-repository ppa:chris-lea/node.js-legacy
    

    Update apt-get:

    sudo apt-get update
    

    Install Node.js:

    sudo apt-get install nodejs=0.8.23-1chl1~precise1
    

    I think (feel free to edit) the version number is optional if you only add node.js-legacy. If you add both legacy and ppa/chris-lea/node.js you most likely need to add the version.

    0 讨论(0)
  • 2020-12-07 13:44

    The n module worked for me.

    Run this code to clear npm’s cache, install n, and install the latest stable version of Node:

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    

    See: http://www.hostingadvice.com/how-to/update-node-js-latest-version/
    And: https://www.npmjs.com/package/n

    To install a specific version of node:

    sudo n 6.11.2

    To check what version:

    node -v

    You might need to restart

    0 讨论(0)
提交回复
热议问题