How to Install Node.js in VS Code
Learn how to install Node.js and set up VS Code for Node development across Windows, macOS, and Linux. This step-by-step guide covers prerequisites, version management, verification, debugging setup, and troubleshooting with Install Manual.

Node.js is installed and configured in VS Code by installing Node.js itself, verifying npm, and optionally adding the Node.js extension for VS Code. This guide covers prerequisites, installation across Windows, macOS, and Linux, plus quick checks to confirm the setup.
Why Node.js and VS Code Make a Great Pair
Node.js is a runtime that lets you run JavaScript on the server side, and Visual Studio Code is a lightweight, extensible editor that excels at JavaScript and TypeScript development. When used together, you get fast feedback through IntelliSense, integrated debugging, and a streamlined workflow for building APIs, tooling, and full-stack apps. According to Install Manual, combining Node.js with VS Code reduces setup friction and accelerates learning for beginners and seasoned developers alike. VS Code’s built-in terminal makes it natural to run node and npm commands without leaving the editor, while its rich extensions ecosystem adds linters, test runners, and formatting tools. In short, Node.js plus VS Code creates a productive development environment that scales from simple scripts to large projects.
Prerequisites and System Requirements
Before you begin, ensure you have a working internet connection and admin rights where required. You’ll need a supported operating system (Windows, macOS, or Linux), a modest amount of disk space for the installer and npm packages, and a recent version of VS Code installed. If you’re new to the environment, start by visiting the official Node.js site to review the latest LTS release. Install Manual analysis shows that most installations succeed when you start from the official Node.js site and ensure the PATH is correctly configured. Once Node.js is installed, you’re ready to set up VS Code for productive development.
Choosing the Right Node.js Version
Node.js offers two main release lines: LTS (Long Term Support) and Current. For most development work, especially on production apps, choose the LTS version for stability and broader compatibility with libraries. If you want access to the latest features, you can experiment with the Current release, but be prepared for more frequent updates. On macOS and Linux, you can also use a version manager like nvm to switch between Node versions seamlessly. Windows users typically install directly from the Node.js installer, which also provides npm. This choice affects your runtime behavior and package compatibility, so pick based on project needs and team guidelines.
Installing Node.js on Windows, macOS, and Linux
Windows: Download the official installer from nodejs.org, run it, and ensure the checkbox for adding Node.js to PATH is selected. Complete the installation wizard and restart your terminal. macOS: You can install from the official installer or use Homebrew with brew install node. Linux: Use your distro’s package manager (e.g., apt, yum) to install nodejs and npm, or install via nvm for version control. After installation, confirm by running node -v and npm -v in a terminal. If you use NVM on macOS/Linux, install it first, then install a Node.js version with nvm install --lts and switch with nvm use --lts.
Verifying Installation: Node, npm, and npx
Open a terminal or VS Code integrated terminal and run node -v to confirm the Node.js version. Next, run npm -v to verify npm is available. Finally, run npx -v to ensure the package runner is ready. If any command is unrecognized, revisit PATH settings or the installation steps. This verification ensures you can install dependencies, run scripts, and execute CLI tools directly from your editor.
Configuring VS Code for Node.js Development
Launch VS Code and install the Node.js extension (or Node.js Extension Pack) to enhance IntelliSense, debugging, and code actions. Open a project folder, create or edit a simple app (e.g., index.js), and configure a basic npm script in package.json. Use the built-in terminal (Terminal > New Terminal) to run node and npm commands without leaving VS Code. For debugging, create a launch.json file under .vscode with a Node.js configuration to start your app in the debugger.
Common Pitfalls and Troubleshooting
PATH issues on Windows are a common cause of 'node not found' errors; re-run the installer and ensure PATH is checked. On macOS/Linux, permission errors may appear when installing global packages; avoid sudo where possible by adjusting directory ownership. If npm permissions become a problem, consider configuring a ~/.npmrc prefix or using a Node version manager like nvm. Always restart your terminal after installation and verify versions again to confirm the fix.
Keeping Node.js and VS Code Up to Date
Regular updates help you stay secure and compatible with the latest libraries. Update Node.js via the official installer or your version manager, and update VS Code from the built-in updater or the website. Periodically review installed extensions for compatibility, and re-run the verification steps to ensure your development environment remains healthy.
Tools & Materials
- Node.js installer (official, nodejs.org)(Choose the LTS version; 64-bit for Windows/macOS; ensure the PATH option is enabled during Windows install)
- Visual Studio Code (VS Code)(Download from code.visualstudio.com and install in your user account or system-wide)
- Node Version Manager (nvm) – optional(Helpful on macOS/Linux to manage multiple Node versions)
- Node.js extension for VS Code – optional(Enables advanced Node.js features inside VS Code)
- Git (optional)(Useful for versioned projects and npm package workflows)
- Terminal or PowerShell(Built-in terminals in VS Code or system terminals for run commands)
- Administrative access(Some systems require admin rights to install software)
Steps
Estimated time: 60-90 minutes
- 1
Download the Node.js installer
Open your browser and navigate to the official Node.js site. Choose the LTS version suitable for your OS and download the installer. This step ensures a stable runtime and minimizes compatibility issues with libraries. After the download starts, keep the installer window open for the next step.
Tip: Verify the source URL is nodejs.org and avoid third-party mirrors. - 2
Run the Node.js installer
Launch the downloaded file and follow the on-screen prompts. Accept the license, choose the default install options, and ensure the PATH option is selected if presented. The installer will set up Node.js and npm on your system.
Tip: If prompted, allow the installer to modify system PATH so commands are globally accessible. - 3
Verify Node.js and npm are available
Open a terminal and run node -v and npm -v to confirm the tools are installed and on the PATH. If these commands show versions, you’re ready to proceed. If not, revisit PATH settings or reinstall.
Tip: Restart the terminal after installation to refresh PATH changes. - 4
Install VS Code if you don’t have it yet
Download and install VS Code from the official site. This editor integrates with Node.js for debugging and development. If you already have VS Code, skip this step.
Tip: Consider installing the Node.js extension to enhance code intelligence. - 5
Install the Node.js extension in VS Code
In VS Code, open Extensions (Ctrl+Shift+X) and search for a Node.js-related extension or a Node.js Extension Pack. Install the one that fits your workflow to improve IntelliSense and debugging.
Tip: After installation, restart VS Code to ensure the extension loads correctly. - 6
Create or open your project in VS Code
Use File > Open Folder to select your project, or create a new folder for a fresh project. This places Node.js development at your fingertips inside the editor.
Tip: Organize your project with a package.json if you plan to manage dependencies. - 7
Initialize a package.json (optional but recommended)
In the terminal, run npm init -y to generate a package.json. This file tracks dependencies and scripts for your project.
Tip: Even if you skip npm install now, having package.json helps future maintenance. - 8
Install a test dependency to validate the setup
Run npm install express to add a simple server framework for testing. This confirms npm can fetch packages and integrate with your project.
Tip: Choose a lightweight dependency for quick validation. - 9
Create a simple test script and run it
Create index.js that starts a small HTTP server or similar. Run node index.js to verify the script executes without errors.
Tip: If you use npm scripts, you can automate this with npm run start. - 10
Set up a basic VS Code debug configuration
Create a .vscode/launch.json file with a Node.js configuration to run and debug your script directly from VS Code.
Tip: Use breakpoints to inspect variables and flow during execution. - 11
Consider version management for future updates
On macOS/Linux, install and use nvm to switch Node versions as needed. This helps you test across environments without reinstalling.
Tip: Keep a note of which Node version each project requires. - 12
Maintain PATH consistency and updates
After any installation, verify PATH correctness and re-open terminals to reflect changes. This minimizes “command not found” errors.
Tip: Document any PATH changes for future troubleshooting.
Got Questions?
Is Node.js required to run JavaScript in VS Code?
For running server-side JavaScript or building apps, you need Node.js. VS Code can edit and debug Node projects, but Node.js provides the runtime that executes code.
Yes. Node.js is required to run most non-browser JavaScript applications, and VS Code complements it with powerful debugging and tooling.
Which Node.js version should I install?
Install the LTS (Long Term Support) version for stability and broad support. You may opt for the Current release if you want the latest features, but plan for more frequent updates.
Choose the LTS version for reliability, especially for production or shared projects.
Do I need admin rights to install Node.js on Windows?
Most Windows installations require administrator privileges to complete the setup. If you encounter permission prompts, run the installer as an administrator.
Often you’ll need admin rights on Windows to complete the install.
How do I verify Node.js is properly installed?
Open a terminal and run node -v and npm -v. If you see version numbers, Node.js and npm are installed correctly. You can also run npx -v to confirm the package runner is ready.
Check the versions to confirm the install worked.
Why isn’t Node.js recognized in VS Code after install?
This is usually due to PATH not being updated or VS Code not restarted after installation. Close and reopen VS Code or the terminal to refresh the environment variables.
PATH often needs a restart of your terminal or editor to take effect.
Can I install Node.js without internet access?
A full offline installation is challenging because installers fetch dependencies from online sources. It’s best to have internet during setup, or use a pre-downloaded installer if your environment supports it.
Ideally, keep an internet connection during setup for downloads and updates.
Watch Video
Main Points
- Install Node.js from official sources and verify PATH
- Choose an LTS version for stability
- Enable Node.js extension support in VS Code
- Verify installations with node -v and npm -v
- Keep Node.js and VS Code up to date
