Kaigai Blog living abroad in my twenties

【My Study Note】Installing node and npm

JavaScript Programming

Verifying the existing installation

Verifying the existing installation on Windows

On Windows, you can use the WINKEY+r shortcut key, which opens the Run window. Inside the Open: input of the Run window, type cmd and press the enter key. This will open the command prompt.

node --version
npm --version  

Verifying the existing Node.js and npm installation on Ubuntu (Linux)

You can quickly open a new bash (terminal) window on Ubuntu by pressing the CTRL+ALT+t shortcut key.

node --version && npm --version

Installing node and npm

On Windows OS

Check here

On Mac OS – XCode

To install brew, you need to install Xcode first. Homebrew does not come with its own compiler and it needs Xcode installed for it to work correctly.

How to install

  • Open a terminal
  • Run the following: shell xcode-select –install
  • A popup will appear asking you to confirm the installation. Click on the Install button
  • Agree to the license agreement

Installing brew

Macs do not come with package managers like most Linux distributions. To make up for this an external tool called brew was created. To install brew, go to the official website ( https://brew.sh/ ) and copy the command provided, open a terminal and run the command.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

After installing brew

brew install node

Homebrew will download and install the dependancies, once this is complete, confirm the installation by typing

node -v

This will display the Node.js version

npm -v

Also, this will display the NPM version number.

On Ubuntu

Use the CTRL+ALT+t shortcut key to open a new bash window, then run the following commands:

sudo apt update 
sudo apt install nodejs