Installing NodeJS without the package manager


There are official instructions for installing nodejs by package manager, if these methods are not working as expected then one could install a single version of nodejs manually with the following instructions: Local Mac, Local Linux, Remote vm Linux. If you need multiple versions of node available, then prior to installing nodejs consider running n-install  to install bash script 'n' OR install nvm, but not both.

On Linux or MacOSX some conditions that may necessitate manual installation are when:

  • the package manager is not available on a virtually hosted linux server because the account owner is not the administrator


  • the package manager does not provide the desired updated version of nodejs as with an older linux or Mac OSX.


 Preliminary considerations

  • Will the nodejs installation be used for development or production?
  • Check to see if a nodejs version is already installed.
  • Determine the operating system type and bus width.
  • Look at the system PATH.

Install on (a really frugal) Mac laptop used for development^

  • In development there might be a need for the developer to login as an alternate user, for presentation purposes for example. To allow multiple users install nodejs in a common directory outside the users directory.
  • With a local terminal check to see which node is already installed

$ which node
$ node -v
$ which npm
$ npm -v
  • if node is already installed there may be work in progress with that revision, avoid deleting the revision.
  • with sudo make a new directory called node_v in '/usr/local' and then switch into it.

$ sudo mkdir /usr/local/node_v
$ cd /usr/local/node_v
  • Confirm the operating system and architecture bus width.  In this case an older MacBook.

$ uname -a
Darwin mycomputer-namehere-MacBook.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 $ arch
  • Check the system PATH variable.

$ printenv PATH
  • Note that in '/usr/local/' 1 checking the ownership of directories, find that the bin directory is owned by root in the admin group.  We probably want our new directory node_v to have the same ownership.

$ cd /usr/local; ls -al
drwxr-xr-x  12 root   wheel  408 Jun  2 12:02 .
drwxr-xr-x@ 12 root   wheel  408 Mar 26  2013 ..
# other stuff here too! drwxrwxr-x 11 root admin 374 Feb 27 09:14 bin


  • With sudo change the ownership of the node_v directory to root and group to admin. Remember sudo will need to preface commands affecting this directory contents.

$ cd /usr/local
$ sudo chown root:admin node_v
  • Change into the node_v directory and with curl or wget download the file appropriate for the computer and operating system.

$ cd /usr/local/node_v
#      curl -o targetFileName sourceURL
$ sudo curl -o node-v4.4.5-darwin-x64.tar.gz

# get the list of shasums for the version being installed
$ sudo curl -o SHASUMS256.txt

# compare the listed sums to the calculated sums of the local files
$ shasum -a 256 -c SHASUMS256.txt 2>&1 | grep OK
node-v4.4.5-darwin-x64.tar.gz: OK

# OK fine keep going.  No OK then you must troubleshoot download.
$ sudo rm SHASUMS256.txt # download was okay, sums list no longer needed

  • Decompress and unarchive the file into directory 'node_v' with tar. (ref->)

$ sudo tar -xvzf node-v4.4.5-darwin-x64.tar.gz --directory=/usr/local/node_v --strip-components=1
# is it there?
$ ls			include				node-v4.4.5-darwin-x64.tar.gz
LICENSE				bin				lib				share
  • Find node in the bin directory and then see if it works.

$ cd node-v4.4.5-darwin-x64/bin
$ node -v
v0.10.35 # Hey! That's a really old version.

# entering the full path ...
$ /usr/local/node_v/node-v4.4.5-darwin-x64/bin/node -v
v4.4.5 #High five! That's the new version.
  • Note that the node old version is still being referenced in the system PATH variable (see below) and so when you type only the shortened path (ie node -v) that is what the system finds.

$ which node
$ printenv PATH


  • Rename the old version of node from node to node_v0.10.35 (to match the version number)

$ cd /usr/local/bin
$ mv node node_v0.10.35
$ node_v0.10.35 -v
v0.10.35 # it still works!


$ cd /usr/local/bin # the symlink should be in a directory accessed by the PATH (in the dir where the old node was)
$ ln -s /usr/local/node_v/bin/node node 
$ node -v
v4.4.5 # see you now have access to the new version of node!
$ /usr/local/bin/node_v0.10.35 -v
v0.10.35 # and you have access to the old version too.

(if the wrong link path is accidentally entered, it can be removed with sudo rm /path/to/the/link , or use the unlink command)

  • The 'npm' symbolic links need to be changed to match the newly installed node version.
    • The old link is part of the the old node
    • A symlink needs to be created for the npm that was installed as part of the new node version as well.

# find and change the symlinks
# where does the old link point?
$ which npm
$ cd /usr/local/bin
$ ls -al
# ... lots of other files here
lrwxr-xr-x 1 root admin 38 Dec 22 2015 npm -> ../lib/node_modules/npm/bin/npm-cli.js
# ... lots of other files here

# the new version of 'npm' should be in something like
$ cd /usr/local/node_v/lib/node_modules/npm/bin

# double check that 'npm-cli.js' is here
$ ls npm*.js
$ pwd
#   copy that working directory!

#   now go back the the directory that is included in the PATH
$ cd /usr/local/bin

#   remove the old symbolic link first
$ sudo rm npm

#   create symbolic link for the updated npm
$ sudo ln -s /usr/local/node_v/lib/node_modules/npm/bin/npm-cli.js npm
#   check to see if it worked
$ npm -v
2.15.5 # the updated version of npm in this example

 Now an updated version of 'node' and 'npm' is installed and available at the command line.

Install on local linux pc used for development^

  • Explore the existing installation with a local terminal
  • determine the linux brand and version, and machine type

$ cat /etc/issue
Fedora release 18 (Spherical Cow)

$ uname -a
Linux localhost.localdomain 3.11.10-100.fc18.i686.PAE #1 SMP Mon Dec 2 21:05:51 UTC 2013 i686 i686 i386 GNU/Linux
  • check to see which node is already installed

$ which node # in this case, none
$ which npm  # in this case, none

  • Inspect the PATH variable

$ printenv PATH
  • Find any symbolic links to 'node' or to 'npm' in the whole system

$ find / -type l 2>/dev/null | grep -E "node$"
# lots of links to hardware related stuff, but none related to nodejs

$ find / -type l 2>/dev/null | grep -E "npm$"
# there is no existing symbolic link for npm

  • No node or npm found, therefor this will be a new multi-user install of node on this machine
  • In the directory '/usr/local' 1 make a directory conveniently named 'node_v' for this example.

$ cd /usr/local
$ sudo mkdir node_v

$ ls -al | grep -E "node_v"
drwxr-xr-x.  2 root root 4096 Jul  1 12:18 node_v
# note that the user and group is root for this directory, will  need a multi-user group 

# on this machine the group named 'shoal01' has been created for development
$ sudo chown root:shoal01 node_v
$ sudo find / -group shoal01
/usr/local/node_v  # it worked!

  • Change into the node_v directory and with curl or wget download the file appropriate for the computer and operating system.

$ cd node_v # remember root still owns the directory
$ sudo wget
  • Decompress and unarchive the file into directory 'node_v' with tar. (ref->)

$ sudo tar -xvzf node-v4.4.7-linux-x86.tar.gz --directory=/usr/local/node_v --strip-components=1
$ /usr/local/node_v/bin/node -v
v4.4.7 #the installation works!

$ cd /usr/local/bin  #a directory that is in the PATH
$ sudo ln -s /usr/local/node_v/bin/node node
$ sudo ln -s /usr/local/node_v/bin/npm npm
$ node -v # check the version
$ npm -v # check the version
#both node and npm are installed!

(if the wrong link path is accidentally entered, it can be removed with sudo rm /path/to/the/link , or use the unlink command)


Install on remote vm linux server^

  • with a local terminal Secure Shell login ssh into a terminal on your remote server
  • Installing nodeJS for a single user. A gist.

template copy me!



The node website:

Check to see if there are any symbolic links to node anywhere on the file system. This find command may take considerable time (many minutes), and provide very little visual feedback.  The user may need to be on the sudoers group.

$find / -type l 2>/dev/null | grep -E "node$"



  1. The '/usr' directory is described as "Programs, libraries, documentation etc. for all user-related programs." in table 3-2 of the file system description at tldp.
  2. Installing npm packages globally for a given user -> .
  3. npm-throws-error-without-sudo
  4. man grep