Nodejs on cpanel problems and how to fix them

I have been messing around for 3 days trying to get my node.js app to work on my remote hosting using WHM/cPanel.
After @Teodor gave us that Plesk tutorial today, I realised that I have actually been doing it correctly from the start and it really should have been working all along.

Well I finally figured out what the issue is, and it turns out I just should have read the node docs a little better.
This is what they say
Screenshot 2020-05-29 at 16.38.59

Wappler has an index.js file and not an app.js file so the passenger script is basically just ignoring the entire app. I have duplicated the index.js file from Wappler and added a second file called app.js, and finally I have a working page.

@George, could index.js be changed to app.js without harming the inner workings or is this going to cause other issues for me as I go.

If when using application manager in your cpanel you get this error


You may need an additional file placed in the root of your cpanel account, so in my case /home/paul called .npmrc and the file contents has this one line in it.

scripts-prepend-node-path=true

Save your file and try run the Ensure dependencies command again and the error should go away, thank you Teo, I would never have figured that one out.

Community Page
Last updated: