Resolving this issue with Passenger

Viewed 483

http://nodejs-resume.example.me/

When the site loads,

/usr/local/dh/passenger/helper-scripts/node-loader.js:37
GLOBAL.PhusionPassenger = exports.PhusionPassenger = new EventEmitter();
^

ReferenceError: GLOBAL is not defined
    at Object.<anonymous> (/usr/local/dh/passenger/helper-scripts/node-loader.js:37:1)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47

I have modified my .htaccess to use node 15.5.0 I am hosting with DreamHost VPS

2 Answers

I believe this error is because the uppercase GLOBAL alias for global was deprecated as of nodejs v14 (or some version near that). As warned here:

The version of Passenger running on DreamHost servers does not currently function with Node.js versions 14+.

you need to use a version of node older than v14 in order for passenger to work. I downgraded node to v13 and this solved the issue for me.

Please change the Object name GLOBAL to global in the mentioned file. Then restart the web Server(eg. nginx, appache). In my case this was fix my issue.

Related