Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save webolizzer/a25ffd9f699aac0a057d9d0e850ec8bb to your computer and use it in GitHub Desktop.
Save webolizzer/a25ffd9f699aac0a057d9d0e850ec8bb to your computer and use it in GitHub Desktop.
commands to install node.js 8x on ubuntu 16 via CLI
// install >>>

// easy way

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

// hard way

// https://stackoverflow.com/a/33033773/2337281
// https://askubuntu.com/questions/898379/how-does-tar-command-work-for-installing-node-js
// https://unix.stackexchange.com/questions/11544/what-is-the-difference-between-opt-and-usr-local

// http://nodejs.org/dist/
$ wget http://nodejs.org/dist/v8.1.2/node-v8.1.2-linux-x64.tar.gz
$ tar -C /usr/local --strip-components 1 -xzf node-v8.1.2-linux-x64.tar.gz
$ which node
$ ln -s /usr/local/bin/node /usr/bin/node
$ with npm
$ ln -s /usr/local/bin/npm /usr/bin/npm
$ node -v
$ npm -v

// uninstall >>>

$ apt-get remove nodejs
$ apt-get remove npm

// clear

find / -name "node"
$ rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules 
$ rm -rf /usr/local/lib/node*
$ rm -rf /usr/local/include/node*
$ rm -rf /usr/local/bin/node*
$ rm -rf /usr/local/share/doc/node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment