var cwd = process.cwd(); Error: No such file or directory
See original GitHub issueWe are seeing this following behavior often with forever.
When starting an app, the following is logged to the error log over and over again:
node.js:289
var cwd = process.cwd();
^
Error: No such file or directory
at Function.resolveArgv0 (node.js:289:23)
at startup (node.js:43:13)
at node.js:448:3
We are running node 4.1.2
and forever 0.7.5
. Forever is instantiated like:
//Setup spawn child
var child = new(forever.Monitor)(torqueObject.start, {
silent: true,
forever: true,
watch: false,
sourceDir: "/nodesocket/gears/" + gear,
outFile: "/nodesocket/gears/" + gear + "/logs/output.log",
errFile: "/nodesocket/gears/" + gear + "/logs/error.log",
logFile: "/nodesocket/gears/" + gear + "/logs/forever.log",
pidFile: "/etc/nodesocket/lever/pids",
options: torqueObject.parameters,
minUptime: 2000,
spinSleepTime: 1000,
killTree: true,
env: torqueObject.env
});
//Acutally spawn child
child.start();
Obviously its trying to get the current working directory, but failing. Any idea what specific code in forever is calling process.cwd()
.
Issue Analytics
- State:
- Created 12 years ago
- Comments:29 (4 by maintainers)
Top Results From Across the Web
NodeJS Error: node.js:810 var cwd = process.cwd()
I got this when created a directory in a git branch, switched to a different branch (without the new directory), and switched back....
Read more >Ecosystem File - PM2
Advanced process manager for production Node.js applications. Load balancer, logs facility, startup script, micro service management, at a glance.
Read more >@rollup/plugin-node-resolve - npm
Useful when executing rollup in a package of a mono-repository. // Set the root directory to be the parent folder rootDir: path.join(process.cwd ......
Read more >Process | Node.js v19.3.0 Documentation
It is possible to record such errors in an error log, either periodically (which ... The process.cwd() method returns the current working directory...
Read more >ENOENT: no such file or directory when deployed to Vercel
After a lot of Googling I stumbled across a GitHub issue which discussed the fact that it was down the use of process.cwd()...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t know if this helps but I ran into this error, then I closed all my terminals and I ran my command “sudo npm cache clean -f” and “sudo npm install -g n” and voila: no more process.cwd problems.
I have an inkling that opened terminals in Vim and in npm folders might be the cause of the error.
Usually this indicates you are attempting to run a node script in a directory that doesn’t exist on the system.
I’d suggest trying to add some guards before the new forever.Monitor call to ensure that your sourceDir, outFile, errFile, etc, exist.