recommended way installing nodejs 12.04 on ubuntu 14.04

72 views
Skip to first unread message

James Ramsfield

unread,
Jun 30, 2015, 9:05:43 PM6/30/15
to nod...@googlegroups.com
Hi

I have the followring question

I'm have tried installing nodejs on ubuntu using the following command:

sudo apt-get nodejs

Problem is that it didnt install v0.12.5, but instead install an early version of nodej (10.4 I think). So I'm im not sure if  'sudo apt-get nodejs
is the correct way of installing nodejs on ubuntu 14.04. So my question is:

What is the recommended way of installing nodejs on ubuntu 14.04?

James

Ryan Graham

unread,
Jun 30, 2015, 10:37:32 PM6/30/15
to nod...@googlegroups.com
The way I tend to do it is grab one of the binary tarballs and just do tar -C /usr/local --strip-compontents 1 -xf node-v0.12.5-linux-x64.tgz, normally by piping directly from curl (from a local mirror which I've already verified the checksums on!). But I tend to use VMs and containers and generate them using scripts, so instead of worrying about the "easy upgrading" of using apt-get, I just re-build the image with a newer version of node.

For my dev environment I just use nvm.

~Ryan

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/c69df078-a1dc-4707-8d8c-bdbb5d08e5c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brandon Moser

unread,
Jul 1, 2015, 10:20:00 AM7/1/15
to nod...@googlegroups.com
If you are looking to use a package manager, Joyent has a full wiki page on it here, https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager. Most of us used to use the Chris Lea PPA for Ubuntu, but now NodeSource is hosting it.

Brandon

Jared R

unread,
Jul 1, 2015, 1:33:05 PM7/1/15
to nod...@googlegroups.com
I have come to prefer compiling from source according to the instructions here:


(note that I did not come up with this method, but I am reposting it here in case something happens to the link)

export NODE_PARENT=/some/desired/install/path_goes_here

export NODE_PARENT=/usr/local/bin/nodejs    # use this if you want to install as root (sudo)
export NODE_PARENT=${HOME}/nodejs-v0.10.33  # use this if you want to install modules as yourself

export PATH=${NODE_PARENT}/bin:${PATH}
export NODE_PATH=${NODE_PARENT}/lib/node_modules

./configure   --prefix=${NODE_PARENT}

make
make install
NODE_PARENT, NODE_PATH, and the alteration to your PATH should all go in your .bash_profile in order to persist between sessions. Also don't forget the --prefix flag with running the configure script!

This gives me node and anything I `npm install -g` in a directory that is local to my user profile (I put it in my Home) without having to use sudo and thus without running into the permissions problems I have had in the past when installing via binary to usr/bin. 

Once the latest node is installed from source I use n to manage other versions. 

Witold Szczerba

unread,
Jul 1, 2015, 1:33:05 PM7/1/15
to nod...@googlegroups.com
My favorite way to install such things is to download binaries from a project webpage and then symlink to /usr/local/bin or whatever other place required. I can later delete the project from disk and remove all broken links.

Regards,
Witold Szczerba

--

Eric Andre

unread,
Jul 2, 2015, 11:28:57 AM7/2/15
to nod...@googlegroups.com
What I've found to work well and easily is get the one the os package manager supplies (apt-get) then get a node version manager package from npm and use that to update node. Nvm or n are some packages. I use n, it was just the first one I used. It allows you to have multiple versions of node and to switch between them. Just do the command n latest or n stable. If you already have multiple versions you can just use n command without arguments or options and it will list all installed versions and you can pick the one you want to switch to.
Reply all
Reply to author
Forward
0 new messages