Run JavaScript code
To run JavaScript code, you can use run configuration or package.json approches.
A run configuration defines the parameters for running your application. It can include commands, executable paths, environment variables, arguments, and other required context.
Creating run configurations
Click the Run icon (⌘ R) and select Create Run Configurations in run.json.
In the run.json file that opens, define running or debugging parameters. If the file is empty, press ⌥ ⏎ or click the file template link.
Alternatively, paste and edit the following code:
{ "configurations": [ { "name": "conf with parameters", "type": "node", "workingDir": "$PROJECT_DIR$", "file": "$PROJECT_DIR$/app.js", "appOptions": ["1", "2", "3"] } ] }Modify the configuration properties according to your environment.
For more information about JavaScript run configurations in JetBrains Fleet, refer to JavaScript run configurations.
Press ⌘ R or select
from the main menu. Select the configuration you want to run or debug.
Alternatively, you can use package.json file to run your code.
Using package.json
Create a package.json file with a
start
script in thescripts
field:"scripts": { "start": "node <file to run> }Click the Run icon in the gutter next to the
start
script and select Run 'start'.Alternatively, press ⌘ R to open the Run&Debug popup and select start from the list.
Manage running applications and tasks
Stop a task
Click the Stop button in the tab of the running task.
Alternatively, close the tab, and select Terminate.
View running tasks
Press ⌘ R. Run & Debug popup opens and lists the tasks. The tasks that are currently running are indicated with a green circle.