簡體   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