Blog about Web Programming and Electronics
💬 👤
back Back to blog
WEB (HTML, CSS, PHP)

How to Install Node.js on PC and Run It in PhpStorm

Node.js has become an essential tool for modern web development. While most know it as an environment for running JavaScript on the server, it is also incredibly useful locally on your machine – whether for task automation, running local development servers, or securing/obfuscating your code.

In this guide, we will take a look at how to correctly install Node.js on your personal computer (PC) and integrate it into the popular PhpStorm IDE, ensuring your development workflow stays smooth and trouble-free.

1. Downloading and Installing Node.js on PC

For local development, I always recommend choosing the LTS (Long Term Support) version, as it is the most stable and thoroughly tested.

  • Visit the official nodejs.org website and download the LTS installer for your operating system.
  • Run the installer file and follow the setup wizard (the standard "Next, Next, Finish").
  • During installation, make sure to check the Add to PATH option, as this allows you to run the node command directly from your terminal.

Once the installation is complete, open your terminal (Command Prompt or PowerShell) and check if the system recognizes Node.js and its package manager (npm):

node -v
npm -v

Both commands should return the currently installed version number (e.g., v20.x.x).

2. Configuration in PhpStorm

PhpStorm provides excellent built-in support for Node.js, but we need to manually point it to the installed interpreter path.

  1. Open PhpStorm and navigate to settings: File > Settings (or press Ctrl + Alt + S).
  2. In the top-left search bar, type Node.js (located under Languages & Frameworks).
  3. In the Node interpreter field, click the three dots (...) and select the path to your node.exe file (PhpStorm usually detects it automatically if added to PATH).
  4. Click Apply and then OK.

3. Creating and Running Your First Local Application

To verify everything is working cohesively, let's create a simple local server. Create a file named app.js in your project and paste the following code:

const http = require('http');

const server = http.createServer((req, res) => {
    res.statusCode = 200;
    res.setHeader('Content-Type', 'text/plain; charset=utf-8');
    res.end('Node.js local server is running perfectly!');
});

server.listen(3000, '127.0.0.1', () => {
    console.log('Server is running at http://127.0.0.1:3000/');
});

To run this code in PhpStorm, simply open the built-in **Terminal** (bottom-left of the window) and type:

node app.js

A notification will appear in the terminal, and you can visit http://localhost:3000 in your browser to see the live result.

back Back to blog