paint-brush
Quick Guide to Install Node, Yarn, Git and VSCode on Linux, Mac, and Windowsby@alexadam
273 reads

Quick Guide to Install Node, Yarn, Git and VSCode on Linux, Mac, and Windows

by Alex AdamJuly 7th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

On Linux (Ubuntu 20.04 LTS): Node.0-Linux-x64/bin. Alternatively, you can install Node from a package package. To install the LTS version, go to https://github.com/nodesource/distributions and/Yarn. install Git with the instructions here: https://brew-sh://://code.visual-studio.com/. Then, open a terminal and run the installer on Windows and install it.
featured image - Quick Guide to Install Node, Yarn, Git and VSCode on Linux, Mac, and Windows
Alex Adam HackerNoon profile picture

On Linux (Ubuntu 20.04 LTS):

Node

Download the Node LTS archive file from https://nodejs.org/ and extract it (in this example, the archive is extracted in /home/user/Downloads/)

Open .bashrc in the home folder (/home/user./bashrc) with a text editor, and append:

PATH=$PATH:/home/user/Downloads/node-v14.17.0-linux-x64/bin

Then, in a terminal:

source .bashrc

node -v
# v14.17.0

npm -v
# 6.14.13

You may also need the development tools to build native addons:

sudo apt install gcc g++ make

Alternatively, you can install Node from a package. To install the LTS version, go to https://github.com/nodesource/distributions and

# You need to install curl if it's not already installed
sudo apt install curl

# Ubuntu
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

Yarn

Install Yarn (from https://yarnpkg.com/getting-started/install)

npm install -g yarn

yarn -v
# 1.22.10

Git

sudo apt install git

VSCode

Download the .deb package from https://code.visualstudio.com/. Then, in a terminal, go to the Downloads folder, and:

sudo dpkg -i code_1.57.0-1623259737_amd64.deb

# test it
code .

On Mac

Node

Download the LTS package from https://nodejs.org and install it (double click on node-v14.17.1.pkg and follow the steps).

Then open a terminal, and:

node -v

npm -v

Yarn

Open a terminal, and:

npm install -g yarn

yarn -v 

NOTE: if you get this error: “npm WARN checkPermissions
Missing write access to /usr/local/lib/node_modules/yarn” run the
following commands:

sudo chown -R $USER /usr/local/lib/node_modules 
sudo chown -R $USER /usr/local/bin
sudo chown -R $USER /usr/local/share/

Then try to reinstall yarn with the command above.

Git

First, install Homebrew by following the instructions here: https://brew.sh

Then, install Git with:

brew install git 

VSCode

Download the package from https://code.visualstudio.com and install it.

On Windows

Node

Download Nodejs LTS from https://nodejs.org and install the package - don't forget to check "Automatically Install the Necessary Tools" in the installer.

Then, open a terminlal (Command Prompt) and:

node -v

npm -v

Yarn

npm install -g yarn

yarn -v

Git

Download the executable from here https://git-scm.com/download/win and run the installer.

Then, open a terminal and:

C:\Users\user>git --version
git version 2.32.0.windows.1

VSCode

Download VSCode from https://code.visualstudio.com/ and run the installer.

Then, to test everything, open a Command Prompt and:

git clone https://github.com/alexadam/project-templates.git

cd projects\react-app

yarn init --yes

yarn add react react-dom

yarn add --dev @types/react @types/react-dom ts-loader css-loader html-webpack-plugin node-sass sass-loader style-loader typescript webpack webpack-cli webpack-dev-server

# Open VSCode
code .

Open package.json and append these lines:

,"scripts": {
"clean": "rm -rf dist/*",
"build": "webpack",
"dev": "webpack serve"
}

Run yarn dev, open a browser, and go to http://localhost:8080/

Previously published at https://alexadam.dev/blog/install-node-yarn-git.html