-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
pm2 start app.js -i 0
fails because Error: ENOENT, no such file or directory
for process.cwd()
#1244
Comments
Open a new terminal and try again. |
Yeah, |
Your might need to re-install pm2 again i guess. |
Yeah I think it's just me. Tried it in another env and it was fine. Thanks for the help though :) |
I rarely have same issue. PM2: 2015-09-09 17:42:48: Starting execution sequence in -cluster mode- for app name:app id:0
PM2: node.js:720
PM2: var cwd = process.cwd();
PM2: ^
PM2: Error: ENOENT, no such file or directory
PM2: at Error (native)
PM2: at Function.startup.resolveArgv0 (node.js:720:23)
PM2: at startup (node.js:63:13)
PM2: at node.js:814:3
PM2: 2015-09-09 17:42:48: App name:app id:0 disconnected
PM2: 2015-09-09 17:42:48: App name:app id:0 exited with code 1 I can't reproduce it. pm2 reinstalling is very bad because it happened on production |
This is not related to pm2, try from another directory or start from a json declaration : http://pm2.keymetrics.io/docs/usage/application-declaration/ by specifying a |
I really use pm2.json: {
"apps": [
{
"name": "api",
"cwd": "/apps/api/current",
"script": "app.js",
"exec_mode": "cluster",
"instances": 0,
"out_file": "/var/log/apps/api/output.log",
"error_file": "/var/log/apps/api/error.log",
"log_date_format": "YYYY-MM-DD HH:mm:ss",
"merge_logs": true
},
...
] So result is the same |
All I can say is that nodejs does not find |
But directory exists :) |
And it's very strange that after pm2 reinstalling all is working |
same issue, a big headache. I can't delete pm2 since I have to keep some of the processes running |
I ran into the same issue. The problem is when you run pm2 from a symlinked dir. Not exactly sure what is going on yet. I'm thinking that running pm2 start outside of the symlinked dir would fix it. |
I ran into this issue too. ** It finally worked after run ** |
I have met the same issue in our production env. |
pm2 runs your main script inside a process container, which means if you run One of the solutions is to use Node's native
|
A late update, I have found the reason of my issue. So make sure you do not remove the work folder when pm2 is still on daemon. even though you recreate it again, pm2 still could not find the folder. |
I ran into the same issue, rebooting the machine fixed it for me... |
Just a FYI, my issue is that the build machine deleted the folder and pm2 cannot find it after that. A simple "pm2 update" solves it (Caution, it reloads all the current app list) |
I ran into the same problem. Following @lvdaqian 's answer, I remembered/realized that I deleted the directory and clone the project back with the same directory path prior to the So we can conclude that whenever the pm2 is running on daemon, the registry of previously started apps and the reference paths is still in its memory and that even the Thanks |
i tried uninstalling/reinstalling pm2, stopping daemon, rebooting whole machine, no combination of anything works. i guess i can wipe out the entire HDD and start AGAIN. where do you store the state for this thing that it is so ridiculously persistent? pm2 update doesn't do jack can you bother to post at least ONE guide on how to solve this? THANKS |
@danoctavian In my experience, this issue is caused by either pm2 being run/installed by root so a normal app cannot run the pm2 executable, or that pm2 daemon was started from a directory that usually gets deleted or cleaned. Example, if you are inside a repo that gets cleaned and checkout by a build machine. After the cleanup, the build machine or script wont be able to find the directory. So to me, the final solution was to kill every single daemon for pm2 and started from command line from a directory that I know won't be changed, like /var or /usr/yourUser. Make sure you start the daemon from that directory. After that, following commands run with pm2 should work, even the ones that involve reloading an app that was just installed/updated/checked out. If that does not work, then double check the user than wants to run the command and the one that installed pm2. Maybe this is from a script that has less permissions than the one you are using or maybe you are doing "sudo npm i pm2" and then running the pm2 from a ctrontab. That I am guessing will cause problems. |
I added PM2_HOME environment variable on a system level and now it works alright.... |
thanks it's really work with pm2 kill ! |
Using |
I am running the PM2 way example here - https://keymetrics.io/2015/03/26/pm2-clustering-made-easy/
However, the process fails 15 times and is then stopped. Here are the logs:
Node
0.12.2
PM2
0.12.14
OSX
10.10.3
The text was updated successfully, but these errors were encountered: