问题
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?
回答1:
**SOLVED**
An .bat file, renamed as "appstart.bat"
cd C:\Users\MyUser\MyApp
npm start
With shortcut in desktop.
回答2:
The bat file should look like the below
cd folder directory
node file.js
Example:
cd users\me\documents\mynodeproject\
node index.js
When you click the bat file shortcut it will open the node command prompt and your console app will launch.
回答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.
来源:https://stackoverflow.com/questions/39512375/is-there-any-way-to-create-an-shortcut-desktop-to-a-node-js-npm-application