Hey,
My Pm2 works fine but my web app won’t run. Then when I check the pm2 report, I get errored on status for both PM2 list and daemon logs. I am using pm2 version 3.2.2 and node version 8.0.0.

the code I run is pm2 start src/index.js and it is a react web app

How can I solve this?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
3 answers

Hello,

What are the exact errors that you get?

Also if you have not already checked the pm2 logs, I would recommend checking your pm2 logs with this command:

pm2 logs

If you are unsure, you could share the logs here so I could advise you further.

If there are no errors, then the problem might be with your application.

Regards,
Bobby

Hi, i am struggling with the same problem. my log error is below. Please advise where to go from here. Thanks in advance.

/root/.pm2/logs/server-error.log last 15 lines:
0|server | Require stack:
0|server | - /var/www/api.diegotrainer.com/html/dt-express-backend/server.js
0|server | at Function.Module.resolveFilename (internal/modules/cjs/loader.js:965:15)
0|server | at Module.Hook.
require.Module.require (/usr/lib/nodemodules/pm2/nodemodules/require-in-the-middle/index.js:61:29)
0|server | at require (internal/modules/cjs/helpers.js:72:18)
0|server | at Object.<anonymous> (/var/www/api.diegotrainer.com/html/dt-express-backend/server.js:120:32)
0|server | at Module.compile (internal/modules/cjs/loader.js:1137:30)
0|server | at Object.Module.
extensions..js (internal/modules/cjs/loader.js:1157:10)
0|server | at Module.load (internal/modules/cjs/loader.js:985:32)
0|server | at Function.Module.load (internal/modules/cjs/loader.js:878:14)
0|server | at Object.<anonymous> (/usr/lib/node
modules/pm2/lib/ProcessContainerFork.js:32:23)
0|server | at Module.compile (internal/modules/cjs/loader.js:1137:30) {
0|server | code: ‘MODULE
NOT_FOUND’,
0|server | requireStack: [ ’/var/www/api.diegotrainer.com/html/dt-express-backend/server.js’ ]
0|server | }

In my situation, I also met pm2 errored:

internal/modules/cjs/loader.js:1068
  throw err;
  ^

Error: Cannot find module './config'
Require stack:
- /usr/my/express/js/app.js
- /usr/my/express/js/bin/www
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1065:15)
    at Function.Module._load (internal/modules/cjs/loader.js:911:27)
    at Module.require (internal/modules/cjs/loader.js:1125:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (/usr/my/express/js/app.js:9:16)
    at Module._compile (internal/modules/cjs/loader.js:1236:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1257:10)
    at Module.load (internal/modules/cjs/loader.js:1085:32)
    at Function.Module._load (internal/modules/cjs/loader.js:950:14)
    at Module.require (internal/modules/cjs/loader.js:1125:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/my/express/js/app.js',
    '/usr/my/express/js/bin/www'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...

As you can see above, I lost my ./config file, because I added it into .gitignore and when I cloned it on local machine, it lost.

Just retrieve the file back, and the problem solved!

Submit an Answer