#Deploying to CPanel nodeJS- What are the steps?

1 messages · Page 1 of 1 (latest)

gritty roost
#

I searched in previous posts but could not find a proper solution. WOuld be really helpful. Thanks

long pebble
#

Same answer as I gave before #1294632113802444800 message

gritty roost
long pebble
#

npm run build

gritty roost
#

build/server/index.js-This will be the application startup file?

gritty roost
#

After running npm run build and uploading the app to server, here for the application startup file

gritty roost
long pebble
#

Good luck!

gritty roost
#

Thanks

gritty roost
#

After setting up the nodejs application and entering the directory, when I run
npm run build I am getting the following error
sh: remix: command not found

#

Do you have any idea regarding this?

late cairn
#

if anybody need help can write me , in the future i can make a tutorial

gritty roost
#

So I just sorted it an hour ago

#

I moved from basic template to the express one

#

And in the application startup file, I put app.cjs and from that I redirected to server.js

#

async function loadApp() { const { app } = await import("./server.js"); } loadApp()

merry swallow
gritty roost
#

I did

#

Uploaded the full project

#

Make a zip, upload it and then extract there

merry swallow
#

I have done the following so far -

#
  1. Ran pnpm run build which generated the build folder.
  2. Zipped, uploaded and extracted my whole project
#

Now what to do?

gritty roost
#

Now in the host run npm install

#

Did you setup nodejs application?

merry swallow
#

This is what my interface looks like

gritty roost
#

Yep

#

Click on run npm install

merry swallow
#

Right after I created the app, it automatically started running. I stopped the app, ran npm install and then restarted the app

#

Lemme check the generated log file

#
/usr/local/lsws/fcgi-bin/lsnode.js:48
    var app = require(startupFile);
              ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/sedbdorg/public_html/sed-test/build/server/index.js from /usr/local/lsws/fcgi-bin/lsnode.js not supported.
Instead change the require of index.js in /usr/local/lsws/fcgi-bin/lsnode.js to a dynamic import() which is available in all CommonJS modules.
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1) {
  code: 'ERR_REQUIRE_ESM'
}
gritty roost
#

Are you using the basic remix template?

merry swallow