Setup: Install Node.js

Install the long-term support version of Node.js and npm, which you will use for JavaScript and front-end frameworks.

Novice · Operating System · Node.js · Updated

After this lesson you can

  • Install Node.js on Windows and check the versions of node and npm

Key takeaways

  • Node.js runs JavaScript outside a web browser, and npm, which comes with it, downloads JavaScript libraries for your projects.
  • Install the long-term support (LTS) version, Node.js 26, with winget install -e --id OpenJS.NodeJS.LTS.
  • node --version should print a version starting with v26. npm --version prints npm's own version number.
  • node -e runs one line of JavaScript straight from the terminal.

Windows only. Node.js runs JavaScript outside a web browser. You will need it later in the course, when you build web front ends with a JavaScript framework. It comes with npm, which downloads JavaScript libraries for your projects.

We install the LTS (long-term support) version: Node.js 26.

Install Node.js

In Git Bash, run:

winget install -e --id OpenJS.NodeJS.LTS

Click Yes if Windows asks whether the app may make changes.

Check your work

Close Windows Terminal completely and open it again. Then run:

node --version
npm --version

You should see a version that starts with v26. for Node.js, and a version number for npm.

Run one line of JavaScript to see Node.js work:

node -e "console.log('Node.js is ready')"

You should see Node.js is ready.

Common problems

What you see What to do
bash: node: command not found Close every Windows Terminal window and open a new one. If it still fails, sign out of Windows and back in.
node --version shows an older version, such as v24. or v20. Another Node.js was installed earlier. Open Settings, go to Apps > Installed apps, uninstall every Node.js, then run the install command again.

Check yourself

2 questions to try on the lesson page.

So what

Every JavaScript tool you use later, from test runners to front-end frameworks, runs on Node.js and arrives through npm. A v26. version now means those installs will just work.

Key terms

  • Node.js
  • npm