我想将我的 Hubot 包装在 Windows 服务中以进行部署。
我正在使用node-windows来执行此操作,但尝试让它运行咖啡脚本文件(这是 hubot 使用的)时遇到了一些麻烦。
如果我手动运行
> coffee .\node_modules\hubot\bin\hubot
一切正常。
但我不知道如何从节点窗口脚本中调用它。我的尝试如下:
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();
失败并显示以下内容:
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 在 FSReqWrap.cb [as oncomplete] (fs.js:226:19)