Next.js Discord

Discord Forum

cPanel Next.js app doesn't work.

Unanswered
Silver posted this in #help-forum
Open in Discord
SilverOP
Hello! I'm trying to host a Next.js app on my cPanel web hosting. I’ve created a Node.js application using Node.js version 22.8.0 and uploaded the project (excluding the node_modules folder) into a new directory via the file manager. However, I’m encountering errors when running npm install and npm run build. The Next.js version I’m using is 15.0.4.

49 Replies

SilverOP
SilverOP
.htaccess File:

# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/twodevsr/twodevs"
PassengerBaseURI "/"
PassengerNodejs "/home/twodevsr/nodevenv/twodevs/22/bin/node"
PassengerAppType node
PassengerStartupFile app.js
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION BEGIN
<IfModule Litespeed>
</IfModule>
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION END
app.js (https://nextjs.org/docs/pages/building-your-application/configuring/custom-server):

package.json

    "scripts": {
        "dev": "next dev --turbopack",
        "build": "next build",
        "start": "NODE_ENV=production node app.js",
        "lint": "eslint . --ext .ts,.tsx -c .eslintrc.json --fix"
    },
This is what i get:
Cuban Crocodile
Will this working on local system?
@Cuban Crocodile Will this working on local system?
SilverOP
Yes. It runs perfectlly.
Cuban Crocodile
In cPanel you can open the terminal and map to that directory and try to run npm install and you can understand better
But npm run build not
That's why I use putty to run the commands.
and i get this
Southern rough shrimp
people still use cPanel?
@Silver and i get this
Southern rough shrimp
copy that path, and then run cat {file path}
what is the contents
SilverOP
@Southern rough shrimp
@Silver and i get this
Southern rough shrimp
do what this error says: make a new issue on their github providing this log file, and the specs of whatever vm youre building on
Southern rough shrimp
Just curious, why are you using a cPanel instead of just hosting it on your own VM?
@Southern rough shrimp Just curious, why are you using a cPanel instead of just hosting it on your own VM?
SilverOP
I don't know to respond to that, I usually use cPanel for Laravel/Symfony projects, so I think I thought its gonna work well for Next.Js too.
Southern rough shrimp
Have you tried Vercel?
I would put money on it being infinitely easier to deploy.
(For free, too)
SilverOP
No i haven't. I did not heard about it.
Southern rough shrimp
It's pretty much the standard when it comes to deploying nextjs applications
I seriously suggest looking into it, and maybe thinking about moving away from cPanel
SilverOP
I'll try it right now.
Southern rough shrimp
Also remove that fucking link from your profile
jesus h christ
@Southern rough shrimp jesus h christ
SilverOP
Hahhahaha.
@Southern rough shrimp (For free, too)
SilverOP
I can see that is only free for 2 weeks, I am right?
Southern rough shrimp
nah
where are you seeing that
SilverOP
@Southern rough shrimp
Southern rough shrimp
yeah your trial
you're on the premium plan for 14 days
then you default to free
SilverOP
ohh, all right.
Southern rough shrimp
hence why it says 'to maintain access to premium feautres'
SilverOP
you are right, im stupid. :))
@Southern rough shrimp hence why it says 'to maintain access to **premium feautres**'
SilverOP
Thank you so much for telling me about vercel, i just refunded the 1 year cPanel host to get my money back and changed the nameservers for my domain and work perfectlly. I appriciate you a lot!
@Southern rough shrimp people still use cPanel?
Wuchang bream
some country cpanel is cheap price so that's why we use it, have any alternative? for production?
Southern rough shrimp
Vercel for nextjs
or just dockerize it and put it on a vm