Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
Invoke a JavaScript or Node.js program using an alias

I am writing a JavaScript program that needs to invoked on the command line using a special command/alias. Instead of typing node fileName.js, I need to be able to just type newFile to run it. My understanding (correct me if I'm wrong) is that I could create a Bash script to run the JavaScript and use an alias to run that. But I would like to avoid using a Bash script if I can.

I looked into Node to see if I can do this. All I found was information about putting the name of the program in the package.json file, as a value for "start", under "scripts." But then to run the program I would have to type npm start. I looked for a way that I could create an alias for npm start within Node itself, but I didn't find one.

Is there a way to do what I want, with or without Node, without using an external script?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No you can't... It might possible with shell script. But in your machine node js run with help of npm.

Every javascript project has a package.json file which is managed package file for your project. So you can not do what you want.

What I suggest: Use nodemon.

npm i nodemon

then in package.json add another script "dev" or whatever you want or you can write under start script.

"dev":"nodemon app.js",

Then everytime you save your application your server will restart automatically

Note: Each time you copy or select something from command prompt while using nodemon; dont forge to press rs

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda