Unable to install latest NodeJS version on Ubuntu 14.04

423

The easiest way to install NodeJS is using the official PPA (which contain the latest version (8.X at the time of this edit).

Open a terminal (Ctrl+Alt+T) and run :

  1. Remove current NodeJS installation

    sudo apt-get purge nodejs*
    
  2. Install curl

    sudo apt-get install curl
    
  3. Install NodeJS:

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install -y nodejs
    

If you absolutely need 0.12 and not 4.1.1 version, run :

  1. Install NodeJS:

    curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
    sudo apt-get install -y nodejs
    
Share:
423

Related videos on Youtube

Samuel
Author by

Samuel

Updated on September 18, 2022

Comments

  • Samuel
    Samuel over 1 year

    I am using django. In my views I want to know which button was pressed.

    My template.html looks like:

    {% for post in posts %}
       <button name="{{ post.pk }}" type="submit">{{ post.title }}</button>
    {% endfor %}
    

    I know that in my views.py I can check if button x was pressed by just:

    if '12345' in request.POST:
       # do something
    elif '23456' in request.POST:
       #do something else
    

    But is there a way to get the primary key without checking every key possible?

    I would love something like this:

    #PSEUDOCODE
    post_primary_key = request.POST.get_name()
    

    If my approach is fundamentally bad, I am also open to alternative ways of solving my problem.

    • karel
      karel over 8 years
      possible duplicate of Installing the latest Node.js / MongoDB? See user's answer for instructions for installing node.js 0.12..
    • ViLuWi
      ViLuWi almost 3 years
      You can make an array and loop through this.
  • Edik Mkoyan
    Edik Mkoyan over 8 years
    This will not help, see the update in question.
  • hg8
    hg8 over 8 years
    Please see my edited answer.
  • gorodezkiy
    gorodezkiy over 8 years
    Worked for me only after I changed distro name of my Ubuntu, which previously was LinuxMint. When I tried to install for the first time, I got error ## Your distribution, identified as "petra", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support. Fixed by changing distro release info as described here askubuntu.com/questions/115429/…
  • Prakhar
    Prakhar almost 3 years
    If you want to send POST request, then please specify will make a little changes. Otherwise if you just want to get the pk of the post which was clicked (which is your question title), then you are good to go.