I would like to wrap my Hubot in a windows service to deploy it.
I am using node-windows to do this but I'm having some trouble trying to get it to run a coffee-script file (which is what hubot uses).
If i manually run
> coffee .\node_modules\hubot\bin\hubot
everything works fine.
But I cant work out how to call this from a node-windows script. My attempt below:
var Service = require('node-windows').Service;
var svc = new Service({
name:'Hubot',
description: 'Hubot',
script: 'coffee .\\hubot\\node_modules\\hubot\\bin\\hubot'
});
svc.on('install',function(){
svc.start();
});
svc.install();
which fails with the following:
C:\\Users\\luke.mcgregor\\hubot>node app.js fs.js:747 return binding.mkdir(pathModule._makeLong(path), ^ Error: ENOENT, no such file or directory 'C:\\Users\\luke.mcgregor\\hubot\\coffee .\\hubot\\node_modules\\hubot\\bin\\daemon' at Error (native) at Object.fs.mkdirSync (fs.js:747:18) at C:\\Users\\luke.mcgregor\\AppData\\Roaming\\npm\\node_modules\\node-windows\\lib\\daemon.js:409:16 at FSReqWrap.cb [as oncomplete] (fs.js:226:19)
The script
is not a command, only the path to a file. You can change the executable used by node-windows to run your scripts by setting an execPath
environment variable: https://github.com/coreybutler/node-windows/issues/61#issuecomment-51423542
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.