# How to run and debug the JavaScript in Intellij IDEA

The best and easiest way to run and debug JavaScript is using node.js. So the first step is to install the node on you laptop. For Mac, just run:

$ brew install node

After the installation, can check the version:

$ node -v
v17.0.1

$ npm -v
8.1.0

Now you can run the JavaScript just with the cmd:

$ node xxx.js

For IDEA, add the Run/Debug configuration:

And click to run and debug:

Note: It can just run the plain JavaScript as it would not provide the HTML DOM.


Reference:

Intellij IDEA, run Javascript code right in the editor (opens new window)

Mac安装nodejs,一次性搞定(必看) (opens new window)

Last Updated: 8/18/2023, 11:39:36 PM