• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Having problem running nodejs app on Plesk

AlbmaniaGroup

New Pleskian
Server operating system version
CentOS 7
Plesk version and microupdate number
18.0.48
First of all Merry Christams and hope you are enjoying the end of the year.
I am new on NodeJS and I have an app build in NodeJS. I have installed nodejs extension on plesk that came installed with phusion passenger server (never heard about it before). Now, I have deploied the software via GIT on the domain account, in a subdomain to be more precise, run the commands provided by documentation (composer install; some php artisa commands, npm run dev).Everything runs perfect with no errors, and when i try to load the page, it shows:

Code:
[ D 2022-12-25 21:42:37.1721 27069/T1 age/Spa/SpawnEnvSetupperMain.cpp:747 ]: shellName = 'bash' detected as supporting '-l': true
/var/www/vhosts/mydemo.com/front.mydemo.com/public/js/app.js:1
(self["webpackChunk"] = self["webpackChunk"] || []).push([["/js/app"],{
^

ReferenceError: self is not defined
    at Object.<anonymous> (/var/www/vhosts/mydemo.com/front.mydemo.com/public/js/app.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1067:19)
    at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
    at require (node:internal/modules/cjs/helpers:103:18)
    at loadApplication (/usr/share/passenger/helper-scripts/node-loader.js:243:2)
    at setupEnvironment (/usr/share/passenger/helper-scripts/node-loader.js:214:2)

On NodeJS extensions, settings looks like this
nodesjs-extension.jpg

I have to mention that the web app is working perfectly on localhost with the same settings but without Plesk. Also, have to mention that I have nGinx running as proxy.

Thank you
 
Hi, I am having the same problem here, after some investigation i found out that:
1. the error is generated from webpack compiler (angular ng build, in mycase)
2. dependency that still use the method self instead of this.

unfortunately, at this momenet, i am still struggling with this error, hopefully we'll find the way

You are not alone :p
 
Hi update of this error, we solve it by reading thru angular docs

here is the link, Angular

what we did:
- adding two files mentioned in the docs, .htaccess and index.html as self reference
- restart the node server

the result:
application works

hopefully it help you

Cheers
 
Hi update of this error, we solve it by reading thru angular docs

here is the link, Angular

what we did:
- adding two files mentioned in the docs, .htaccess and index.html as self reference
- restart the node server

the result:
application works

hopefully it help you

Cheers
Hello there.
Thank you for your updates. Unfortunately we are not using Angular but pure node for react web app, and still struggling with the issue :-(
Thanks anyway for your help. I will check out that documentation whith the hope that I may find any clue to progress.
 
For anyone that may have the same issue, I have resolved it by Disableing the Node Application from plesk ("Disable Node.js" button as on the image attached above). Somehow, when it is enabled, it crashes something, so I have run all the commands on the terminal and left Node.js from Plesk GUI disabled. Everything works perfectly now. Hope it will help anyone.
 
Back
Top