Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy feathersjs application in pm2?

I'm using feathersjs framework to develop nodejs application and I am trying to implement it in pm2 and it's not working.

drwxr-xr-x   8 root root   4096 Sep 20 06:45 ./
drwx------  12 root root   4096 Sep 20 06:48 ../
drwxr-xr-x   2 root root   4096 Sep 20 06:48 config/
-rw-r--r--   1 root root    214 Sep 20 06:44 .editorconfig
-rw-r--r--   1 root root    334 Sep 20 06:44 .eslintrc.json
drwxr-xr-x   8 root root   4096 Sep 20 07:02 .git/
-rw-r--r--   1 root root    884 Sep 20 06:44 .gitignore
-rw-r--r--   1 root root   1076 Sep 20 06:44 LICENSE
drwxr-xr-x 391 root root  16384 Sep 20 06:45 node_modules/
-rw-r--r--   1 root root    594 Sep 20 06:44 .npmignore
-rw-r--r--   1 root root   1716 Sep 20 06:44 package.json
-rw-r--r--   1 root root 119897 Sep 20 06:44 package-lock.json
drwxr-xr-x   2 root root   4096 Sep 20 06:44 public/
-rw-r--r--   1 root root     84 Sep 20 06:44 README.md
drwxr-xr-x   6 root root   4096 Sep 20 06:48 src/
drwxr-xr-x   3 root root   4096 Sep 20 06:44 test/
-rw-r--r--   1 root root  84576 Sep 20 06:44 yarn.lock

This is my application folder structure:

I'm running following way

$ cd src
$ pm2 start app.js

And I'm getting following error:

0|app      | TypeError: Path must be a string. Received undefined
0|app      |     at assertPath (path.js:7:11)
0|app      |     at Object.join (path.js:1218:7)
0|app      |     at Object.<anonymous> (/home/limitless/Documents/projects/work/iRouteApp/src/app.js:36:22)
0|app      |     at Module._compile (module.js:570:32)
0|app      |     at Object.Module._extensions..js (module.js:579:10)
0|app      |     at Module.load (module.js:487:32)
0|app      |     at tryModuleLoad (module.js:446:12)
0|app      |     at Function.Module._load (module.js:438:3)
0|app      |     at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:70:21)
0|app      |     at Module._compile (module.js:570:32)
0|app      |     at Object.Module._extensions..js (module.js:579:10)
0|app      |     at Module.load (module.js:487:32)
0|app      |     at tryModuleLoad (module.js:446:12)
0|app      |     at Function.Module._load (module.js:438:3)
0|app      |     at Module.runMain (module.js:604:10)
0|app      |     at run (bootstrap_node.js:389:7)
0|app      |     at startup (bootstrap_node.js:149:9)
0|app      |     at bootstrap_node.js:502:3
PM2        | App [app] with id [0] and pid [14134], exited with code [1] via signal [SIGINT]
PM2        | Starting execution sequence in -fork mode- for app name:app id:0
PM2        | App name:app id:0 online
0|app      | WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
0|app      | WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
0|app      | WARNING: No configurations found in configuration directory:/home/limitless/Documents/projects/work/iRouteApp/src/config
0|app      | WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
like image 859
KARTHIKEYAN.A Avatar asked Mar 09 '23 00:03

KARTHIKEYAN.A


1 Answers

app.js is not the root file in feathersjs boilerplate.

it should be index.js

so just use pm2 start src/

like image 99
Amit kumar Avatar answered Mar 10 '23 14:03

Amit kumar