How to Install Node.js?
Steps vary as per operating systems to install Node.js, please follow the methods as per installed operating system.
- Installation on Windows
- Installation on Linux – Ubuntu
Local Environment Setup
If you are still willing to set up your environment for Node.js, this section will guide you. Node.js can be installed on different OS platforms such as Windows, Linux, Mac OS X, etc. You need the following tools on your computer −
- The Node.js binary installer
- Node Package Manager (NPM)
- IDE or Text Editor
Binaries for various OS platforms are available on the downloads page of the official website of Node.js. Visit https://nodejs.org/en/download/package-manager to get the list.
Official Website : https://nodejs.org/en/download/package-manager
This page shows different sets of binaries for different OS platforms, one for the current or latest version is V22.11.0, and the other a version with LTS (Long Term Support), that is recommended for a normal user.
Installation on Windows
Assuming that you are working with Windows 10/Windows 11 powered computer, download the 64-bit installer for Windows: https://nodejs.org/dist/v22.11.0/node-v22.11.0-x64.msi, and start the installation by double-clicking the downloaded file.
OR Aletenatively, you can run below commands in Windows Power shell / Command-Line.
# installs fnm (Fast Node Manager)
winget install Schniz.fnm
# configure fnm environment
fnm env --use-on-cd | Out-String | Invoke-Expression
# download and install Node.js
fnm use --install-if-missing 22
# verifies the right Node.js version is in the environment
node -v # should print `v22.11.0`
# verifies the right npm version is in the environment
npm -v # should print `10.9.0`
#Set these below in environment, chnage location as per your installation
D:\Program Files\nodejs
D:\Program Files\nodejs\node_modules\npm\bin
C:\> npm -v
npm : File D:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system. For
more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ npm -v
+ ~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\> Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
PS C:\> npm -v
10.9.0
Installation on Linux
# installs fnm (Fast Node Manager)
curl -fsSL https://fnm.vercel.app/install | bash
# activate fnm
source ~/.bashrc
# download and install Node.js
fnm use --install-if-missing 22
# verifies the right Node.js version is in the environment
node -v # should print `v22.11.0`
# verifies the right npm version is in the environment
npm -v # should print `10.9.0`
C:\> npm -v
npm : File D:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system. For
more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ npm -v
+ ~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\Anuj Verma> Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
PS C:\Users\Anuj Verma>
PS C:\Users\Anuj Verma>
PS C:\Users\Anuj Verma> npm -v
10.9.0
NPM (Node Package Manager) is included in Node.js binaries from its official website since Node version 0.6.0., so you are not required to install it separately.
You can use any text editor available in your OS (notepad in Windows OS, vi or nano in Ubuntu OS) to key-in and save the Node.js script. However, it is recommended that you use a suitable IDE for the purpose as it has several features such as syntax highlighting etc. VS Code is a popular source-code editor, which has out of the box support for JavaScript (and hence Node.js), which is highly recommended. You can download Visual Studio Code from link https://code.visualstudio.com
Recent Comments