S
S
Sergey Nikolaev2015-09-29 19:39:31
System administration
Sergey Nikolaev, 2015-09-29 19:39:31

How to properly run Pm2 from Ubuntu/Linux?

If you write:
pm2 start app.js - everything starts and works as it should,
but if you do:
pm2 start /home/{projectname}/app.js
then a mountain of errors related to the application paths falls ...
How to make it understand where the application root is ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nook Scheel, 2015-10-02
@Devastor

It is necessary to build a project relative to the executable file, put all the paths in the config, for example.

var __project       = exports.__project       = path.join(__dirname, '../')
  , __app           = exports.__app           = path.join(__project, app)
  , __configs       = exports.__configs       = path.join(__project, 'config')
  , __helpers       = exports.__helpers       = path.join(__app, 'helpers')

D
Ddddd, 2015-09-29
@Ubayd

Try sudo pm2 start /home/{projectname}/app.js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question