Skip to main content

Node.js

Installation on Ubuntu (18.04/16.04)#

Reference

## the following line is not needed for Ubuntu 18.04 as the dependencies are installed already# sudo apt-get install curl python-software-propertiescurl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -sudo apt-get install nodejs

To verify version 12 has been installed successfully:

node -v npm -v

Install yarn package manager#

NOTE: Many have said yarn is no longer relevant, as it no longer has much advantages over Node.js https://yarnpkg.com/lang/en/docs/install/#debian-stable

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.listsudo apt-get update && sudo apt-get install yarn

history below


Fix npm Global Install Permissions#

First check, where npm point to, if you call:

npm config get prefix

If /usr is returned, you can do the following:

mkdir ~/.npm-globalexport NPM_CONFIG_PREFIX=~/.npm-globalexport PATH=$PATH:~/.npm-global/bin

To make it permanent, add the export items in the .bashrc

Last updated on