Is there any way to create an shortcut desktop to a Node.js (npm) application?

11,032

Solution 1

**SOLVED**

An .bat file, renamed as "appstart.bat"

cd C:\Users\MyUser\MyApp
npm start

With shortcut in desktop.

Solution 2

Because Node-Red is usually installed globally _

a Node-Red.bat file could simply be

cd \
Node-Red

then use convertico.com to change the Node-Red.png file to Node-Red.ico.

Slick Willy

Solution 3

You can also create a shortcut and set "Target" to...

C:\Windows\System32\cmd.exe /k "node index.js"

... and set "Start In" to the directory index.js is in.

Share:
11,032
Ulises Vargas De Sousa
Author by

Ulises Vargas De Sousa

Thirsty for knowledge, hungry for code.

Updated on June 09, 2022

Comments

  • Ulises Vargas De Sousa
    Ulises Vargas De Sousa over 1 year

    Inexperienced users want to "see" the app that I've created in Node.js, but they don't want to use the console. According to them, it's a good idea to install it, and with a simple click, in desktop, they could "see" it.

    They want to run the Node.js app as a Windows program. That's all!

    How can I do it? Should I create a batch file?

  • aschipfl
    aschipfl about 7 years
    I would add the /D switch to cd to avoid trouble when the current working directory resides on another drive; and if npm is a batch file on its own, prepend call (it does not actually make a difference here, because npm is the last command line anyway, but if you put more commands here afterwards, execution only returns to this batch file with call; in case npm is an executable, forget about all of this)...
  • Ulises Vargas De Sousa
    Ulises Vargas De Sousa about 7 years
    This is assuming that user install node.js for Windows and stores the app in C:\Users\MyUser. For my particular case, is it.
  • THE JOATMON
    THE JOATMON almost 2 years
    This is the best answer as it eliminates the need for yet another script (batch file).