Error Build - App Router - cPanel
Unanswered
Asiatic Lion posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
npm run build
> front-end@0.1.0 build
> next build
â–² Next.js 14.0.4
- Environments: .env
✓ Creating an optimized production build
✓ Compiled successfully
✓ Linting and checking validity of types
uncaughtException Error: spawn /home/myuser/.nvm/versions/node/v18.18.2/bin/node EAGAIN
at ChildProcess._handle.onexit (node:internal/child_process:284:19)
at onErrorNT (node:internal/child_process:477:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn /home/myuser/.nvm/versions/node/v18.18.2/bin/node',
path: '/home/myuser/.nvm/versions/node/v18.18.2/bin/node',
spawnargs: [
'/home/myuser/myhost/node_modules/next/dist/compiled/jest-worker/processChild.js'
]
}
OS: Linux
Node Version: 18.18.2
In cPanel terminal
56 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
i just tried this, but still error,
i am using cPanel and next 14.0.4 app router
i am using cPanel and next 14.0.4 app router
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
same error?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
yes
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
have you tried set cpus to 1?
cpus: 1
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
i was and stuck linting
â–² Next.js 14.0.4
- Environments: .env
- Experiments (use at your own risk):
· cpus
✓ Creating an optimized production build
✓ Compiled successfully
Linting and checking validity of types ...
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
try set it to 2?
how many cpu does your node have?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
how about export standalone?
i just tried that on my local and i found new errors, when i run
i just tried that on my local and i found new errors, when i run
node .next/standalone/server.js
and open localhost:3000
JS files is not found and images is bad request749-edb9e24670462805.js:1
Failed to load resource: the server responded with a status of 404 (Not Found)
page-224bb38b1e2df8d6.js:1
Failed to load resource: the server responded with a status of 404 (Not Found)
589-029791705fa11408.js:1
Failed to load resource: the server responded with a status of 404 (Not Found)
layout-8033a408314b1dfe.js:1
Failed to load resource: the server responded with a status of 404 (Not Found)
image:1
Failed to load resource: the server responded with a status of 400 (Bad Request)
image:1
$ nproc
8
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
set this in
next.config.js
output: 'standalone'
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
Yes, I have done it, and I encountered the errors above
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
so the build process success? and you tried to start the server with
node .next/standalone/server.js
?![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
yes, build is success in local, but when i open the localhost:3000, css, js, images is not loaded
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
yes because in standalone mode, you have to copy public and static folder manually
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
cp ./public .next/standalone/
cp .next/static .next/standalone/.next/
to
.next/standalone
?![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
yes
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
standalone solved thanks bro, now want to try up to cpanel
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
@Ray error 400 bad request image
GET https://myweb.com/_next/image?url=%2Fimages%2Fhello.jpg&w=384&q=75 400 (Bad Request) image:1
GET https://myweb.com/_next/image?url=%2Fimages%2Fhello2.jpg&w=384&q=75 400 (Bad Request) image:1
in local it's working fine, but in my hosting is error 400
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
try start the standalone build in local
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
its working fine, but in my cpanel found 400 bad request in the browser console when i open the web
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
could you show a screenshot of the standalone folder
ls standalone
ls standalone/.next
ls standalone/.next
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
![Image](https://cdn.discordapp.com/attachments/1193390675052474420/1193442234020933742/shot-2024-01-07_14-32-06.png?ex=65acbab1&is=659a45b1&hm=441af6217fc2d89bbd89c348def6dc095762fa1a065d9973d7f60c46368c821f&)
![Image](https://cdn.discordapp.com/attachments/1193390675052474420/1193442501160337470/shot-2024-01-07_14-33-42.png?ex=65acbaf1&is=659a45f1&hm=e4244711a0f7aebe223035a99c13311a4ca69c60c30128d3b15dd80ed50e63de&)
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
how do you start the server on the hosting?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
node .next/standalone/server.js
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
could you open the network console and try to access the site and show a screenshot
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
i found this error
just for image 400 bad request
css and js it's work
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
open the image directly in the browser
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
![Image](https://cdn.discordapp.com/attachments/1193390675052474420/1193445329178202185/shot-2024-01-07_14-44-38.png?ex=65acbd93&is=659a4893&hm=3ed39db8dd4d1a23d76021da7fcae6e3ef605ecabec4c09cee4fbc2b32999e4a&)
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
how did you render the image?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
using Image from 'next/image'
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
what do you put it in
src
?![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
<Image
src="/images/hello.png"
alt="Hello"
width={500}
height={500}
className="mx-auto max-w-[20rem] sm:max-w-full"
priority
/>
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
can you open https://myweb.com/images/hello.png?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
yes i found the image, and no error
but it's not optimized right?
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
this link no
do you have sharp installed?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
yes
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
can you try this?
import hello from "/images/hello.png";
<Image
src={hello}
alt="Hello"
width={500}
height={500}
className="mx-auto max-w-[20rem] sm:max-w-full"
priority
/>
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
@Ray i found the image when i put the origin on the image url
https://myweb.com/_next/image?url=https://myweb.com/images/hello.jpg&w=640&q=75
Oh using basepath config right?
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
you using basePath in next.config.js?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
i will try
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
no that doesn't help
should be related to this
https://nextjs-forum.com/post/1190671824296607744#message-1192659929027330118
https://nextjs-forum.com/post/1190671824296607744#message-1192659929027330118
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
My hosting use apache
Using custom image loader maybe?
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
could you show the config?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asiatic LionOP
I couldn't, my cpanel is limited