I have a app4.js with content:
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
I'm on Win10 cmd, I can success run it with node app4.js and get Example app listening on port 3000!,
but when I use forever -a forever.log start app4.js, it show error
Forever detected script exited with code: 0
Where is the problem? How to solve it?
Cmd Message:
D:\app>node app4.js
Example app listening on port 3000!
^C
D:\app>forever -a forever.log start app4.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
error: Forever detected script exited with code: 0
Another Answer say it's related to ./bin/www, but I can't understand what does it mean.
It means try moving your app.js code to the www file in the bin directory.
in .bin/www
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
Also seems to be a known bug on certain versions of node/forever.
Issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With