Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: "cwd" must be a string on Node 8 #41

Open
zipang opened this issue Jun 6, 2017 · 13 comments
Open

TypeError: "cwd" must be a string on Node 8 #41

zipang opened this issue Jun 6, 2017 · 13 comments

Comments

@zipang
Copy link

zipang commented Jun 6, 2017

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.

zipang added a commit to zipang/daemon.node that referenced this issue Jun 6, 2017
@zipang
Copy link
Author

zipang commented Jun 14, 2017

Is there anyone who could review my PR ? It should be really fast i believe.

@unilynx
Copy link

unilynx commented Jun 22, 2017

For anyone else affected, a quick workaround is to apply zipang's PR:

npm install 'github:zipang/daemon.node#48d0977c26fb3a6a44ae99aae3471b9d5a761085'

@jhuckaby
Copy link

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:

zipang@48d0977

Before:

var cwd = opt.cwd || process.cwd;

After:

var cwd = opt.cwd || process.cwd();

Thanks!

jhuckaby added a commit to jhuckaby/pixl-server that referenced this issue Nov 10, 2017
Workaround for Node 8 and daemon module issue:
indexzero/daemon.node#41
@p-salido
Copy link

@indexzero Ping, can we get #42 into an NPM release?

@p-salido
Copy link

The workaround for this issue should be to pass in cwd in options, which typically would be set to /.

@c1tt1
Copy link

c1tt1 commented Dec 14, 2017

same issue here but when implemented in modern node way it works

@jhuckaby
Copy link

@stern0 What is the "modern node way"?

@c1tt1
Copy link

c1tt1 commented Dec 14, 2017

@jhuckaby actually I was wrong the same issue persists

@c1tt1
Copy link

c1tt1 commented Dec 14, 2017

@jhuckaby but the latest PR works

@jhuckaby
Copy link

@stern0 Yup, just need OP to merge it ;)

@silverwind
Copy link

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.

@rafaelquines
Copy link

Thank you @silverwind. You saved my life. If you don't did it, I'll fork daemon project to fix this issue. Congratulations

@FredericGuilbault
Copy link

Using daemonize-process solved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants