Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

richardhulbert's avatar

Has anyone else had a problem with npm run prod

I get a fail with FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

I have tried adding --max_old_space_size=4096 to the script in package.json but it doesn't solve my problem.

Any ideas?

Richard

0 likes
6 replies
Sinnbeck's avatar

It was the reason I switched from mix to vite

It's shipped with laravel now and if you are on laravel 9 you can migrate

richardhulbert's avatar

Hmm thanks @sinnbeck . I am running a Laravel 8 project. Was it straight forward to migrate from mix to vite?

Sinnbeck's avatar

@richardhulbert back then it wasn't. I did it manually, writing my own helper functions etc. But in laravel 9 it's built in, and there is a built plug in as well

You can try installing a new project to test it out https://laravel.com/docs/9.x/vite#main-content

If you like it and want to upgrade, there is a guide https://github.com/laravel/vite-plugin/blob/main/UPGRADE.md

If you for some reason cannot upgrade laravel to 9, these is also an unofficial package https://laravel-vite.dev/

richardhulbert's avatar

Thanks for the info @sinnbeck . I won't mark this as solved as it really doesn't solve the issue around webpack and why it is baulking with a memory error. I will look at Vite when I have time to retool.

Sinnbeck's avatar

@richardhulbert that's fair. I just know I spend more time trying to get webpack to play nice with my production server, than I did implementing vite :)

Please or to participate in this conversation.