Node.js is a popular platform for developing server and web applications. This guide will show you how to set up Node.js and npm on Windows.
Step 1: Installing Node.js
- Go to the official Node.js website
- Download the LTS version (recommended for stable development)
- Install by following the installation wizard and check Add to PATH
Step 2: Checking the Installation
Open PowerShell and run:
node --version
npm --version
- The versions of Node.js and npm should appear
Step 3: Setting Up the Project
- Create a folder for the project and navigate to it:
mkdir my-node-project cd my-node-project - Initialize the project:
npm init -y
Step 4: Installing Popular Packages
- Install Express, dotenv, and nodemon:
npm install express dotenv npm install --save-dev nodemon - Add a start script in
package.json:"scripts": { "start": "node index.js", "dev": "nodemon index.js" }
Step 5: Using Git and VS Code
- Install Git via Scoop or officially
- Set up VS Code for working with Node.js
- Install extensions: Node.js, ESLint, Prettier
Conclusion
After these steps, Node.js and npm are ready for full-fledged development on Windows. You will be able to create server applications, use npm packages, manage dependencies, and integrate the environment with your code editor.