Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

454
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda