-
Notifications
You must be signed in to change notification settings - Fork 26.8k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stuck on Creating an optimized production build
forever when development server is running
#37825
Comments
Facing the same issue |
i have same issue !! |
Execute the steps of “ creating an optimized production build ” on the Linux server node v14.17.0 |
same issue |
Same issue for us |
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. |
same issue! |
Same issue for React.js project as well even when development server is not running on |
I have the same issue!!! |
Same Issue. In development it worked, but when I try to create the Docker image it stuck |
I solved with the next steps:
|
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 |
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.+ |
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 |
Mine was also solved. I faced this issue because a dependency wasn't comfortable with the latest nextjs. 🙃 |
Mine was solved when downgrading from next 13 to next 12.2 |
Try by Tracing warnings with node: |
I am having the same issue! I tried all the possible solutions, but cannot find the reason why it's stuck on "Creating an optimized production build.."
Something is not compiling right maybe ? |
Make sure you don't run development and build the at the same time. |
Yeah, I tried that, I tried removing package-lock and node modules and reinstall everything.. Nothing helped. And I don't know where to even start debugging.
when removed this block it gave me errors in the logs that it failed to compile and that it couldn't import Alert, message and badge components from antd (which I use more than just those). |
Mine was solved when downgrading from next 13 to next 12.2 To upgrade you can run the following command in the terminal: npm install next@12 yarn add next@12 then, delete .next folder and build next project: npm run build |
I faced the same error using next v13, updating to 13.0.5 the error is gone. |
I'm on 13.0.2 and it hangs. I'm going to try to move to latest. |
Moving to 13.0.5 worked. Makes me think there is some kind of bug that keeps creeping up in the builder since I see it's been showing up in different versions going back to 12.x.x |
My stuck due to tailwind. I remove those and it work. |
Any new about it. I am having the same problem when building docker image and upgrading from node 14 to node 16 |
FWIW: I got finally a clean build by adjusting the versions in package.json to most recent ones, Even so Dependencies used: "dependencies": {
"@next-auth/prisma-adapter": "^1.0.6",
"@prisma/client": "^4.13.0",
"next": "13.3.4",
"nodemailer": "^6.9.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "18.16.3",
"@types/nodemailer": "^6.4.7",
"@styled-icons/material": "^10.47.0",
"@types/react": "18.2.0",
"@types/react-dom": "18.2.1",
"eslint": "8.39.0",
"eslint-config-next": "13.3.4",
"prisma": "^4.13.0",
"typescript": "5.0.4"
} |
The same problem existed in my code also but it solved when I closed and restarted everything, but got another error Export encountered errors on following paths: |
This is my own issue whenever I try to run a CI build for my nextjs typescript project: |
same here, never finished, seems the next/font package in a docker env. |
In my case, it was related to some missing dependencies that were present as |
This was my issue also, thanks for saving me the time! |
I had the same issue and I found out the cause by adding this to my process.on('unhandledRejection', error => {
console.log('unhandledRejection', error);
}); And I found out that the issue was the next build getting stuck when it couldn't download the fonts from Google. I turned off the VPN, and it worked. |
npm i next@latest && use this script to serve the output page: |
I was having problem when trying to build and also when running i'm still using next 13.4.2 |
When I run I followed Vercel's guide on dockerisation and their freshly cloned example also hangs forever. If you check the picture above, mine is still hanging after running for 6200+ seconds (1h+). The problem is very likely not:
What I noticed about the So for me, it could be a configuration issue or some Docker-Sonoma issue. Does anyone else see themselves in this issue as well? |
I Solved This Same Issue by Just Simpling Follow This Steps
> yarn next build
> yarn next exportThis sequence ensures that the necessary production build is available for the export command to work with. Once the export command completes, you should have your static files ready for deployment. Make sure to follow these steps in the correct order to resolve the issue. |
is there any solution to fix it |
the same. have you solved this problem? i almost tried everything i could do. delete the cache, update dependency to latest version, but it is still stucking on the step. And i tried to build this project in local, it completed very soon. But stuck on the step when i build it in docker. |
i fixed that by using OrbStack to use 'docker build' command. The problem seems to be caused by Docker Desktop. |
This!!!!! Docker Desktop is the problem. For anyone trying to run My builds would often fail, and sporadically work. When it worked, it could take 30 minutes to an hours. I switched to OrbStack and the build worked flawlessly, in about 2 minutes. |
Facing the same issue. Worked fine before updating to macOS Sonoma. Should create a new issue for this as it doesn't seem related to the original issue. |
I'm also facing builds getting stuck. No docker in my setup. During both I get the following output running
and similar output from
CPU usage goes to 100% in these states. Need to force quit the next process. Edit: Fixed it. I had messed up my Tailwind config.My /** @type {import('tailwindcss/types').Config} */
const config = {
content: ["./**/*.{js,ts,jsx,tsx}"],
//...
}
module.exports = config That's a content glob that's going to make the compiler traverse all node_modules directories. Fixed it with /** @type {import('tailwindcss/types').Config} */
const config = {
content: [
"./**/*.{js,ts,jsx,tsx}", // Include all matching files
"!./node_modules/**", // Exclude everything in node_modules
],
//...
};
module.exports = config; |
That was the solution for me as well. I've switched to OrbStack and it worked seamlessly. |
I solved it by fixed eslint version. "eslint": "8.34.0",
"eslint-config-next": "13.2.1", |
Great to hear! I will try this. |
In my case, I suspected that it was some virtualization issue, and I was right. Once I disabled |
I tried OrbStack, it gave a nice performance boost, but it did not solve the issue. |
I solved this issue by using CMD in the final build step instead of RUN RUN npm run build CMD [ "npm", "run", "start" ] |
i just upgraded nodejs to the latest version and worked like a charm |
Extremely helpful - we'd removed a dependency with a transitive dependency we relied on implicitly. We were only able to determine this with the above process log. |
I actually had this problem and I managed to fix it by upgrading my Linux machine memory |
Hi everyone! I will be moving this to We still encourage folks to file bugs outside of this thread detailing the exact issue, with a Happy 2024! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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.
The text was updated successfully, but these errors were encountered: