2017-09-20 1 views
1

J'utilise le framework feathersjs pour développer l'application nodejs et j'essaie de l'implémenter en pm2 et ça ne fonctionne pas.Comment déployer l'application feathersjs en pm2?

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 

Ceci est ma structure de dossier de l'application:

Je suis en cours d'exécution comme suit

$ cd src 
$ pm2 start app.js 

Et j'obtiens l'erreur suivante:

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. 

Répondre

2

app.js est pas le fichier racine dans Feathersjs.

il devrait être index.js

donc il suffit d'utiliser pm2 start src/

+0

Oui, j'oublie de revoir. Merci :), il fonctionne très bien. @Amit Kumar –