1

I am trying to deploy a NodeJs App : DemocracyOs, on apache with Passenger.

The Makfile of this project runs npm :

npm run start

The documentation of Passenger requires to enter the target json file app.js.

In that case I understand this is index.js.

However, when I try to launhc passenger with this file, or to run it directly with

node index.js

... I get the following error :

module.js:471
throw err;
^

Error: Cannot find module 'lib/config'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/raphael/democracyos/index.js:2:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

I guess npm does something specific with package.json, which defines some kind of mapping :

"browser": {
    "lib/config": "lib/config/config"
}

How can I get Passenger behave like npm ?

Raphael Jolivet
  • 3,940
  • 5
  • 36
  • 56
  • Based on this: https://github.com/defunctzombie/package-browser-field-spec You should be able to simply move the relevant package into place (not you'll have to keep both the server path and client path valid which is a bit of a mess). However there may be a built-in mechanism to perform this for you, but it's not documented on that page. – Camden Narzt Oct 30 '17 at 14:30
  • I had the same issue and I ended up using [PM2](https://pm2.io/runtime/) which let me run `pm2 start npm --name "my-app" -- start`. Anyway I'd love to know how to achieve the same with Passenger. – a.barbieri Sep 21 '18 at 21:03

0 Answers0