I have a NodeJS program managed by systemctl. Up until recently, this has been working but I did an upgrade of the system (Ubuntu 16.04.3 LTS) recently and I'm not sure why making a call to child_process.fork throws ENOENT for a version of node installed via nvm.
My setup:
- Ubuntu 16.04.3 LTS
- NodeJS installed with nvm, under a non-privileged account
nodebb
- My systemctl service
- The platform
- The plugin throwing the error at this call
This is the exact error causing my process to crash:
29/10 16:53:17 [9891] - error: Error: spawn /usr/share/nginx/nodebb/.nvm/versions/node/v4.8.5/bin/node ENOENT
at exports._errnoException (util.js:907:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:189:32)
at onErrorNT (internal/child_process.js:363:16)
at nextTickCallbackWith2Args (node.js:511:9)
at process._tickCallback (node.js:425:17)
And the binary is indeed in that location, and permissions are correct (parent folders are accessible by the nodebb
user):
nodebb@server:~$ /usr/share/nginx/nodebb/.nvm/versions/node/v4.8.5/bin/node -v
v4.8.5