cPanel Next.js app doesn't work.
Unanswered
Silver posted this in #help-forum
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 ENDapp.js (https://nextjs.org/docs/pages/building-your-application/configuring/custom-server):
package.json
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
Bighead carp
people still use cPanel?
@Silver and i get this
Bighead carp
copy that path, and then run
cat {file path}what is the contents
SilverOP
@Bighead carp
@Silver and i get this
Bighead carp
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
Bighead carp
Just curious, why are you using a cPanel instead of just hosting it on your own VM?
@Bighead carp 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.
Bighead carp
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.
Bighead carp
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.
Bighead carp
Also remove that fucking link from your profile
jesus h christ
@Bighead carp jesus h christ
SilverOP
Hahhahaha.
@Bighead carp (For free, too)
SilverOP
I can see that is only free for 2 weeks, I am right?
Bighead carp
nah
where are you seeing that
SilverOP
@Bighead carp
Bighead carp
yeah your trial
you're on the premium plan for 14 days
then you default to free
SilverOP
ohh, all right.
Bighead carp
hence why it says 'to maintain access to premium feautres'
SilverOP
you are right, im stupid. :))
@Bighead carp 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!
Make sure to mark as complete or unanswered
@Bighead carp people still use cPanel?
Wuchang bream
some country cpanel is cheap price so that's why we use it, have any alternative? for production?
Bighead carp
Vercel for nextjs
or just dockerize it and put it on a vm