#Deploying to CPanel nodeJS- What are the steps?
1 messages · Page 1 of 1 (latest)
Same answer as I gave before #1294632113802444800 message
I read it but still did not exactly understand.
Also how to generate server.js file?
npm run build
build/server/index.js-This will be the application startup file?
After running npm run build and uploading the app to server, here for the application startup file
Oh okay! Thank you so much
Good luck!
Thanks
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?
if anybody need help can write me , in the future i can make a tutorial
Did you ran npm install?
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()
Hello there! I am planning to host on my CPanel as well. Did you upload the generated build folder or the whole project into the server?
Can you kindly elaborate this part please?
I have done the following so far -
- Ran
pnpm run buildwhich generated thebuildfolder. - Zipped, uploaded and extracted my whole project
Now what to do?
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'
}
Are you using the basic remix template?
I am using react router 7 framework mode
I feel like this is a Express related issue