Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

453
Views
How to view javascript compiler error messages when running Node program from VSCode?

In VCode, if I hit F5 (Start Debugging), this produces:

enter image description here

No useful exception or other errors are sent to the PROBLEMS, OUTPUT, TERMINAL or DEBUG CONSOLE tabs. Where are my error details?

But if I directly run it from the command-line, I get actual useful output:

$ /home/sir/.nvm/versions/node/v12.16.1/bin/node ./app.js
/home/sir/jstest/app.js:2
import 'xxxxx';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1072:16)
    at Module._compile (internal/modules/cjs/loader.js:1122:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47

This seems reasonable. Why can't I see the same VSCode?

I have added a NodeJS Launch Program run configuration: .vscode/launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
        "name": "Launch Program",
        "program": "${workspaceFolder}/app.js",
        "request": "launch",
        "skipFiles": [
            "<node_internals>/**"
        ],
        "type": "pwa-node"
    }
    ]
}

(I have verified it is used by changing the app.js target to some junk, and seeing an error).

The simple program I want to see compiler errors for is, app.js:

import 'xxxxx';   // An error, missing file

Also... I hope (in 2021) VSCode could hightlight this as an error in the editor. Is that not a feature?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!