在 windows 服务上执行 "grunt serve"

Execute "grunt serve" on windows service

我有一台安装了 nodejs 的 windows 服务器 PC。

我需要在启动时自动执行我的 grunt 应用程序,我想使用 windows 服务。

解决方法是在 "startup" 文件夹中使用 link 启动 "cmd",但是 windows 服务更好...有办法吗?

提前致谢

卢卡

你可以用 winser 做到这一点: https://www.npmjs.com/package/winser

示例:

如果您的 grunt 文件在 D:\app 上并且您希望 grunt 文件在 D:\app (cwd) 中执行并且 grunt 不在您的路径中 (grunt [not grunt-cli] is installed locally)

winser -i --startcmd "node D:\app\node_modules\grunt\bin\grunt --base D:\app --gruntfile D:\app\gruntfile.js"