{"action":"created","issue":{"url":"https://api.github.com/repos/Unitech/PM2/issues/1018","labels_url":"https://api.github.com/repos/Unitech/PM2/issues/1018/labels{/name}","comments_url":"https://api.github.com/repos/Unitech/PM2/issues/1018/comments","events_url":"https://api.github.com/repos/Unitech/PM2/issues/1018/events","html_url":"https://github.com/Unitech/PM2/issues/1018","id":57737447,"number":1018,"title":"Programmatic API doesn't show process","user":{"login":"davidearlotto","id":10465372,"avatar_url":"https://avatars.githubusercontent.com/u/10465372?v=3","gravatar_id":"","url":"https://api.github.com/users/davidearlotto","html_url":"https://github.com/davidearlotto","followers_url":"https://api.github.com/users/davidearlotto/followers","following_url":"https://api.github.com/users/davidearlotto/following{/other_user}","gists_url":"https://api.github.com/users/davidearlotto/gists{/gist_id}","starred_url":"https://api.github.com/users/davidearlotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidearlotto/subscriptions","organizations_url":"https://api.github.com/users/davidearlotto/orgs","repos_url":"https://api.github.com/users/davidearlotto/repos","events_url":"https://api.github.com/users/davidearlotto/events{/privacy}","received_events_url":"https://api.github.com/users/davidearlotto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-15T17:14:30Z","updated_at":"2015-02-16T18:45:07Z","closed_at":null,"body":" Hi All, \r\nI'm having trouble with the programmatic api:\r\n-I run this test script:\r\n        \r\n        var pm2 = require('pm2');\r\n        pm2.connect(function() {\r\n        pm2.start('test.js', { name: 'test'}, function(err, proc) {\r\n          if (err) throw new Error('err');\r\n       \r\n          // Get all processes running\r\n          pm2.list(function(err, process_list) {\r\n             console.log(process_list);\r\n            })\r\n         });\r\n        });\r\n\r\nBut the only log I'm getting on the console is:\r\n\r\n       [PM2] Spawning PM2 daemon\r\n\r\nProbably I'm missing something. At the moment the test.js just logs all the numbers\r\nfrom 0 to 1000.\r\nThanks!\r\nCheers!\r\n        "},"comment":{"url":"https://api.github.com/repos/Unitech/PM2/issues/comments/74554503","html_url":"https://github.com/Unitech/PM2/issues/1018#issuecomment-74554503","issue_url":"https://api.github.com/repos/Unitech/PM2/issues/1018","id":74554503,"user":{"login":"davidearlotto","id":10465372,"avatar_url":"https://avatars.githubusercontent.com/u/10465372?v=3","gravatar_id":"","url":"https://api.github.com/users/davidearlotto","html_url":"https://github.com/davidearlotto","followers_url":"https://api.github.com/users/davidearlotto/followers","following_url":"https://api.github.com/users/davidearlotto/following{/other_user}","gists_url":"https://api.github.com/users/davidearlotto/gists{/gist_id}","starred_url":"https://api.github.com/users/davidearlotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidearlotto/subscriptions","organizations_url":"https://api.github.com/users/davidearlotto/orgs","repos_url":"https://api.github.com/users/davidearlotto/repos","events_url":"https://api.github.com/users/davidearlotto/events{/privacy}","received_events_url":"https://api.github.com/users/davidearlotto/received_events","type":"User","site_admin":false},"created_at":"2015-02-16T18:45:07Z","updated_at":"2015-02-16T18:45:07Z","body":"Thanks. I figured out some modules were missing. Now it starts, but it doesn't retrieve me the list of processes. The log is like this:\r\n\r\n        PM2: 2015-02-16 19:41:21: [PM2][WORKER] Started with refreshing interval: 30000\r\n        PM2: 2015-02-16 19:41:21: [[[[ PM2/God daemon launched ]]]]\r\n        PM2: 2015-02-16 19:41:21: BUS system [READY] on port /home/davide/.pm2/pub.sock\r\n        PM2: 2015-02-16 19:41:21: RPC interface [READY] on port /home/davide/.pm2/rpc.sock\r\n\r\nAnd the file is like this:\r\n       \r\n        pm2.connect(function(){\r\n            pm2.start(process.cwd() + '/Documents/Projects/zendesk_app_projects/test-pm2/test.js',\r\n              {instances : 1},\r\n              function(err, data) {\r\n                  proc1 = data[0];           \r\n                  console.log(proc1);\r\n                  process.exit();\r\n          });\r\n        });\r\n\r\nThanks a lot"}}