繁体   English   中英

Hubot Windows服务

[英]Hubot windows service

我想将Hubot包装在Windows服务中进行部署。

我正在使用节点窗口来执行此操作,但是在尝试使其运行咖啡脚本文件(hubot使用的文件)时遇到了一些麻烦。

如果我手动运行

> coffee .\node_modules\hubot\bin\hubot

一切正常。

但是我不知道如何从节点Windows脚本中调用它。 我在下面的尝试:

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>节点app.js fs.js:747返回binding.mkdir(pathModule._makeLong(path),^错误:ENOENT,没有这样的文件或目录'C:\\ Users \\ luke。 mcgregor \\ hubot \\ coffee。\\ hubot \\ node_modules \\ hubot \\ bin \\ daemon'在Object.fs.mkdirSync(fs.js:747:18)在Error:(native)在C:\\ Users \\ luke.mcgregor \\ AppData \\ Roaming \\ npm \\ node_modules \\ node-windows \\ lib \\ daemon.js:409:16在FSReqWrap.cb [完成时](fs.js:226:19)

script不是命令,仅是文件的路径。 您可以通过设置execPath环境变量来更改节点窗口使用的可执行文件来运行脚本: https : //github.com/coreybutler/node-windows/issues/61#issuecomment-51423542

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM