pm2
pm2 copied to clipboard
'Error: can not create directories' on windows during pm2 start
System disk is C:\, but my app placed on D:\myapp
I have pm2 config here: D:\myapp\pm2.json
{
"apps": [
{
"exec_mode": "fork_mode",
"cwd": "d:/myapp",
"script": "app.js",
"name": "MyApp",
"max_memory_restart": "1G",
"max_restarts": 50,
"env": {
"PORT": 80,
"NODE_ENV": "production"
},
"error_file": "d:/myapp/logs/pm2/ege-public.err.log",
"out_file": "d:/myapp/logs/pm2/ege-public.out.log"
}
]
}
I tried to start pm2 process like this: pm2 start pm2.json and i got error:
2015-11-02 09:53:24: Trace: [Error: can not create directories (logs/pids):ENOENT, no such file or directory 'd:\Users\user1\.pm2\logs']
at Object.God.logAndGenerateError (C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\lib\God\Methods.js:30:15)
at C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\lib\God\ForkMode.js:86:13
at Object.module.exports.startLogging (C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\lib\Utility.js:93:14)
at Object.forkMode (C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\lib\God\ForkMode.js:84:13)
at Object.executeApp (C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\lib\God.js:197:9)
at ex (C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\lib\God.js:368:18)
at prepare (C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\lib\God.js:374:7)
at Server.onmessage (C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon-rpc\lib\server.js:105:6)
at RepSocket.emit (events.js:110:17)
at Parser.<anonymous> (C:\Users\user1\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\rep.js:51:15)
Env variable PM2_HOME is set like this: PM2_HOME=c:\Users\bikkinin.N-K\.pm2
It seems to be that pm2 trying to use relative paths for pm2 global logs relatively to D:\ where app is placed instead of using C:\Users\user1\.pm2. Is it bug or i just missed some option in pm2 config?
If anyone still have this issue, you just need to create the folder logs and pids in your .pm2 and it should work.