简体   繁体   English

错误:永远检测到脚本退出代码:0

[英]error: Forever detected script exited with code: 0

I have a simple script to watch change in file, index.js我有一个简单的脚本来观察文件index.js 的变化

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

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

I am trying to run it via command我正在尝试通过命令运行它

forever start index.js

Its showing output:它的显示输出:

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

and the control is returning to command prompt, instead of staying there!并且控制正在返回命令提示符,而不是停留在那里! How can I keep it running and get the console.log output as soon as file is changed?如何保持运行并在文件更改后立即获取 console.log 输出?

forever start index.js will start up in the background. forever start index.js将在后台启动。 From the sounds of it, you want it to stay in the foreground.从它的声音来看,你希望它保持在前台。 Use forever index.js instead.改用forever index.js

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

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