Search code examples
javascriptnpmintellij-idea

Run simple Javascript Scratch in IntelliJ IDEA Ultimate


I would like to run and debug a simple (plain) Javascript I created over the Ctrl + Shift + Alt + Insert shortcut in my IntelliJ Idea Ultimate.

I'd like to prevent to have to implement any boilerplate like a HTML file or npm project.

What is the easiest way to do it? Am I just overlooking any obvious feature?

I searched for a run feature similar to the Java launch configuration and tried it over a plain node project using npm init --yes and npm run in the same folder, but to no avail.


Solution

  • Normally all you need is right-clicking your JavaScript scratch file and choosing Run:

    enter image description here

    But you have to make sure that Node.js plugin is enabled in IDEA, and the local Node.js interpreter is installed and configured in Settings | Languages & Frameworks | Node.js