Stuck on Creating an optimized production build
forever when development server is running
#60147
Replies: 88 comments 17 replies
-
Facing the same issue |
Beta Was this translation helpful? Give feedback.
-
i have same issue !! |
Beta Was this translation helpful? Give feedback.
-
Execute the steps of “ creating an optimized production build ” on the Linux server node v14.17.0 |
Beta Was this translation helpful? Give feedback.
-
same issue |
Beta Was this translation helpful? Give feedback.
-
Same issue for us |
Beta Was this translation helpful? Give feedback.
-
The same issue still exists.... any remedies. In my case, it was hours I stuck at this "creating an optimized production build". And also I didn't run the development server in the background. |
Beta Was this translation helpful? Give feedback.
-
same issue! |
Beta Was this translation helpful? Give feedback.
-
Same issue for React.js project as well even when development server is not running on |
Beta Was this translation helpful? Give feedback.
-
I have the same issue!!! |
Beta Was this translation helpful? Give feedback.
-
Same Issue. In development it worked, but when I try to create the Docker image it stuck |
Beta Was this translation helpful? Give feedback.
-
I solved with the next steps:
|
Beta Was this translation helpful? Give feedback.
-
Same issue but I wasn't aware that this was happening due the open dev webserver. So the solution for me is on your title: close the development server, then run |
Beta Was this translation helpful? Give feedback.
-
I am still facing the same issue. Using the latest NextJs 12.3.2-canary.34 facing this issue since I'm trying 12.3.2-carany.+ |
Beta Was this translation helpful? Give feedback.
-
You can't have both dev and build at the same time. I solved it very quickly when I realized that there were several nodejs processes open when there should only be 1, and killing all the nodejs processes that were running in the background solved it for me.It can also happen that a build started to fail and got stuck in the background so you should kill all the nodejs you see running in the task manager. I am using Nextjs 13 |
Beta Was this translation helpful? Give feedback.
-
Mine was also solved. I faced this issue because a dependency wasn't comfortable with the latest nextjs. 🙃 |
Beta Was this translation helpful? Give feedback.
-
i also have this issue it work fine on my mac m1 pro 32gb but not on starter packakge on vps service like (5 usd digital ocean,ligstsale ,linode) it will take forever |
Beta Was this translation helpful? Give feedback.
-
Same here while building on Self managed GitLab (Kubernetes cluster + kubernetes runner) |
Beta Was this translation helpful? Give feedback.
-
Same here, I've tried:
None of them worked, it just stuck on |
Beta Was this translation helpful? Give feedback.
-
Same! so what the heck going on when npm run build inside docker |
Beta Was this translation helpful? Give feedback.
-
In my case, it works fine when I run build on my local machine but it gets stuck forever when building docker image. I was using "oven/bun" as my base docker image and I suspected that the issue is from bun's image. So, I switched to "node:20.11.1-slim" base docker image and I ran "npm install -g bun" in my Dockerfile to install bun and it worked like a charm! I hope this helps someone |
Beta Was this translation helpful? Give feedback.
-
After trying all recommendation here and all are not working, I just found out the reason after 2 weeks of debugging is Hope this helps you guys, cheers! |
Beta Was this translation helpful? Give feedback.
-
Make sure to stop the localhost and remove the current .next file. |
Beta Was this translation helpful? Give feedback.
-
I got a great solution that is not to use this kind of problematic framework anymore. I hope this helps someone |
Beta Was this translation helpful? Give feedback.
-
I had this issue on DigitalOcean and AWS EC2 instances. Turns out it was simply RAM running out since the instances were 2GB RAM. After Resizing/upgrading to 4GB RAM, build worked well for me. Posting this in case this is the issue for some people. |
Beta Was this translation helpful? Give feedback.
-
This problem keeps cropping up and can take hours of valuable time to track down. I suggest that Next.js provide more verbose logging to their build process. Right now it's a black box guessing game of "why does the build hang this time". Should not be difficult to add verbose build logging. In the past I've had to reboot for the build to work !?!. Now the reboot trick doesn't work. |
Beta Was this translation helpful? Give feedback.
-
I think the issue is next/font /google build in next js package. i just comment google font coding part.. everything working . |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Just want to add another edge case here for future reference if any of the above doesn't work. I'm using the n package manager and I thought I was changing my local node version to a lower version that was compatible with the next build but it turns out I wasn't because my node version was being managed by homebrew instead of n. See this thread for reference or just run 'brew unlink node' and try again. |
Beta Was this translation helpful? Give feedback.
-
Removing |
Beta Was this translation helpful? Give feedback.
-
Verify canary release
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 16.13.0
npm: N/A
Yarn: N/A
pnpm: 6.24.0-1
Relevant packages:
next: 12.1.4
react: 17.0.2
react-dom: 17.0.2
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
I had my development server running in the background without me remembering and I wanted to build my app using
next build
, that's what I've got:And I was stuck for 30 minutes on
info - Creating an optimized production build
without any indication of anything being wrong, I noticed that the development server was running, after I've shut it down and rannext build
again It compiled successfully.Expected Behavior
Run
next build
to compile the app for production even when I'm running the development server.OR
Notify me that the development server is running and needs to be shut down before running
next build
, that's in case runningnext build
whennext
is running isn't possible.Link to reproduction
https://github.com/YassinEldeeb/Next.js-starter
To Reproduce
next
for the development server.next build
while the development server is running.Note: It's not specific to the repository linked above.
Beta Was this translation helpful? Give feedback.
All reactions