Follow these steps to install Node.js (which includes npm) and the TypeScript compiler on Windows.
-
Download Node.js:
- Go to the official Node.js website: https://nodejs.org/
- Download the LTS (Long-Term Support) version.
- Command to open the website (optional, run in Command Prompt or PowerShell):
start [https://nodejs.org/](https://nodejs.org/)
-
Install Node.js:
- Run the downloaded
.msi
installer. - Follow the on-screen instructions. The installer will typically include npm.
- Run the downloaded
-
Verify Node.js and npm Installation:
-
Open Command Prompt (search for "cmd" in the Start Menu) or PowerShell (search for "powershell").
-
Run the following commands to check the installed versions:
node -v
Expected Output: A version number (e.g.,
v18.16.0
)npm -v
Expected Output: A version number (e.g.,
9.5.1
)
-
-
Install TypeScript Compiler:
- In the same Command Prompt or PowerShell window, run the following command to install TypeScript globally:
This command downloads and installs the TypeScript compiler so you can use it from any project.
npm install -g typescript
- In the same Command Prompt or PowerShell window, run the following command to install TypeScript globally:
-
Verify TypeScript Installation:
- Run the following command to check the installed version of the TypeScript compiler:
Expected Output: A version number (e.g.,
tsc -v
Version 5.0.4
)
- Run the following command to check the installed version of the TypeScript compiler:
Now you have npm and the TypeScript compiler installed on your Windows system.