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

469
Visualizações
How to run node.js file without typing "node abc.js" in command line in Windows in VSCode?

I'm trying to run this script in vscode :-

#!"C:\Program Files\nodejs\node.exe"

console.log("Hello world");

And in command line I enter :-

./abc.js

Each time I run this, the cursor goes to the end of script. Whereas, I'm trying to see "Hello World" on command line. Is something wrong with the shebang line.

Also, Ques.2 Is it possible to run the script without the filename also. For e.g. in the following code :-

#!"C:\Program Files\nodejs\node.exe"

function hello(){
  console.log("Hello World");
}

In command Line I would simply enter this :-

hello
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

  1. npm init your project. this will create package.json file in your working project folder.

  2. Open package.json file, under scripts section write a script: Mine looks like this:

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "local": "nodemon server.js"
  }

when I run npm local in command line, it will run server.js file. P.S. nodemon is a node.js framework. either you need to install it (npm install nodemon -g) or use node server.js command instead.

about 4 years ago · Juan Pablo Isaza Relatório
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