2016-03-30 25 views
0

我有一個簡單的腳本來觀看文件的變化, index.js錯誤:永遠的檢測腳本代碼退出:0

var watch = require('node-watch'); 

watch('C:\CRM\log.txt', function(filename) { 
    console.log(filename, ' changed.'); 
}); 

我試圖通過命令來運行它

forever start index.js 

它表示輸出:

warn: --minUptime not set. Defaulting to: 1000ms 
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms 
info: Forever processing file: index.js 

和控制是返回到命令提示符,而不是呆在那裏!如何在文件更改後立即運行並獲取console.log輸出?

+0

爲什麼不使用永久(-w)的手錶功能? –

回答

0

forever start index.js將在後臺啓動。從它的聲音,你希望它留在前臺。改爲使用forever index.js