Replies: 5 comments 7 replies
-
I am also facing same issue, my app also works fine in local but, after hosting in cpanel with all steps followed, the app goes blank. |
Beta Was this translation helpful? Give feedback.
-
Same here, we had a website hosted on cpanel for almost a year already, it crashed when I updated my packages to match nextjs13 |
Beta Was this translation helpful? Give feedback.
-
Same thing. I tested some versions, 13.4.13 is the last one that works for me. With later versions I just get empty responses (even with the example project). |
Beta Was this translation helpful? Give feedback.
-
Same issue here but on a Plesk server. I've also made changes to the I'm using Next 13.4.19 and Node 16.20. |
Beta Was this translation helpful? Give feedback.
-
Bumping this, as the issue still persists with Next.JS 14 and 15-RC.0. |
Beta Was this translation helpful? Give feedback.
-
Summary
I deployed my Next.js app on cPanel and its blank. It works fine locally. Here are the steps I followed :
1.First, I created a custom server.js in my root directory with the following code :
`const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')
const dev = process.env.NODE_ENV !== 'production'
const hostname = 'localhost'
const port = 3000
// when using middleware
hostname
andport
must be provided belowconst app = next({ dev, hostname, port })
const handle = app.getRequestHandler()
app.prepare().then(() => {
createServer(async (req, res) => {
try {
// Be sure to pass
true
as the second argument tourl.parse
.// This tells it to parse the query portion of the URL.
const parsedUrl = parse(req.url, true)
const { pathname, query } = parsedUrl
})
.once('error', (err) => {
console.error(err)
process.exit(1)
})
.listen(port, () => {
console.log(
> Ready on http://${hostname}:${port}
)})
})
`
"scripts": { "dev": "next dev", "build": "next build", "start": "NODE_ENV=production node server.js", "lint": "next lint" },
After all these steps, my app is blank, and I don't know what I did wrong.
Here is a Github link where you can see all the app code. I'm stuck since yesterday and I appreciate any help you can give me to resolve this problem. I know the issue is due to my app but I can't figure it out. But I'm pretty sure the main problem is located on the server.js file.
I hope all the information I provided could help you to understand.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions