【问题标题】:Hubot windows serviceHubot 窗口服务
【发布时间】:2016-02-07 02:30:12
【问题描述】:

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

我正在使用 node-windows 来执行此操作,但我在尝试让它运行咖啡脚本文件(这是 hubot 使用的)时遇到了一些麻烦。

如果我手动运行

> coffee .\node_modules\hubot\bin\hubot

一切正常。

但我不知道如何从 node-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>node 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) 在 C:\Users\luke.mcgregor\AppData\Roaming\npm\node_modules\node-windows\lib\daemon.js:409:16 在 FSReqWrap.cb [as oncomplete] (fs.js:226:19)

【问题讨论】:

  • 您是否尝试过使用 forever 来运行它 (github.com/foreverjs/forever) 是否存在将其作为服务运行的严格依赖,以便您可以作为特定用户运行它?

标签: node.js coffeescript hubot node-windows


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多