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

Programmatic launch fails #858

Closed
onury opened this issue Dec 2, 2014 · 1 comment
Closed

Programmatic launch fails #858

onury opened this issue Dec 2, 2014 · 1 comment

Comments

@onury
Copy link

onury commented Dec 2, 2014

I'm on Mac OS X. I have a local installation of pm2 in my project's node_modules and I'm using the programmatic example to run my app through pm2.

pm2.conf.json

{
    "name": "api",
    "script": "./core/cluster.js",
    "instances": "2",
    "log_date_format": "YYYY-MM-DD",
    "log_file": "./logs/child.log",
    "error_file": "./logs/child-error.log",
    "out_file": "./logs/child-out.log",
    "exec_mode": "cluster_mode",
    "port": 9005
}

process.js

pm2.connect(function (err) {
    pm2.start("./config/pm2.conf.json", {}, function (err, proc) {
        if (err) { throw new Error('err'); }
    });
});

In terminal:

$ cd /Users/oy/projects/pm2-test/
$ node process.js

>>> [PM2] Spawning PM2 daemon
>>> fs.js:427
>>>   return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
>>>                  ^
>>> Error: ENOENT, no such file or directory '/Users/oy/.pm2/pm2.log'
>>>     at Object.fs.openSync (fs.js:427:18) ....
>>>     ...

It looks like pm2 is looking for .pm2/pm2.log file under my user folder. I guess, this should be the case for a global installation. I've declared some log directories within my JSON config but it didn't help.. Any ideas?

@Tjatse
Copy link
Collaborator

Tjatse commented Dec 2, 2014

Call pm2.pm2Init() at first (it's a synchronous function), there is a lack of Programmatic Document.

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

2 participants