Saturday 20 May 2017

Express.js w/ Compass doesn't work with PM2

I have used the express-generator to generate a project with compass stylesheet engine:

express --css compass app

The app as expected when I start using npm start (or node ./bin/www, fwiw).

However, when I use pm2 to run the app, as pm2 start ./bin/www the app runs and returns an html response, but the CSS fails when the browser requests it, the process dies and pm2 restarts it. This is behind an nginx which returns a 502 Bad Gateway.

These are the pm2 logs:

0|www      | GET /home 200 320.238 ms - 914
0|www      | Error: spawn compass ENOENT
0|www      |     at exports._errnoException (util.js:1050:11)
0|www      |     at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
0|www      |     at onErrorNT (internal/child_process.js:367:16)
0|www      |     at _combinedTickCallback (internal/process/next_tick.js:80:11)
0|www      |     at process._tickDomainCallback (internal/process/next_tick.js:128:9)
PM2        | App [www] with id [0] and pid [6624], exited with code [1] via signal [SIGINT]
PM2        | Starting execution sequence in -fork mode- for app name:www id:0
PM2        | App name:www id:0 online

I can't find any info as to why this is happening, and why it's working with node, but not with pm2. Any help appreciated.



via rgthree

No comments:

Post a Comment