daemon.node
daemon.node copied to clipboard
TypeError: "cwd" must be a string on Node 8
After upgrading to Node 8, we have an error on startup when launching a NodeBB server. This issue has been documented here : https://community.nodebb.org/topic/10765/error-starting-nodebb-after-upgrade
And here is the full error stack which has its origin in the daemon
module used by NodeBB :
TypeError: "cwd" must be a string
at normalizeSpawnArguments (child_process.js:380:11)
at Object.exports.spawn (child_process.js:465:38)
at Function.module.exports.daemon (/www/node-bb/node_modules/daemon/index.js:50:31)
at module.exports (/www/node-bb/node_modules/daemon/index.js:25:20)
at /www/node-bb/loader.js:223:21
at FSReqWrap.oncomplete (fs.js:135:15)
According to the API documentation, process.cwd()
is effectively a method : https://nodejs.org/api/process.html#process_process_cwd
The fix is quite trivial and i will provide a Pull Request for it.
Is there anyone who could review my PR ? It should be really fast i believe.
For anyone else affected, a quick workaround is to apply zipang's PR:
npm install 'github:zipang/daemon.node#48d0977c26fb3a6a44ae99aae3471b9d5a761085'
Paging @indexzero, is it possible for you to merge this PR? It's a trivial bug fix, and would help us out. Node 8 is now in LTS, so many more people will be using this. Two character fix:
https://github.com/zipang/daemon.node/commit/48d0977c26fb3a6a44ae99aae3471b9d5a761085
Before:
var cwd = opt.cwd || process.cwd;
After:
var cwd = opt.cwd || process.cwd();
Thanks!
@indexzero Ping, can we get #42 into an NPM release?
The workaround for this issue should be to pass in cwd
in options, which typically would be set to /
.
same issue here but when implemented in modern node way it works
@stern0 What is the "modern node way"?
@jhuckaby actually I was wrong the same issue persists
@jhuckaby but the latest PR works
@stern0 Yup, just need OP to merge it ;)
As this module appears abandoned, I went ahead and created the daemonize-process module, in case anyone's interested in a maintained version of daemon
.
Thank you @silverwind. You saved my life. If you don't did it, I'll fork daemon project to fix this issue. Congratulations
Using daemonize-process solved it.