Out of memory error in gulp (imagemin) and how to deal with it

When using the imagemin plugin to optimize images using gulp, you may receive the error message FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory.

This indicates that gulp has consumed all available memory and cannot allocate new memory.

To solve this problem, you can raise the memory limit when starting gulp. Use the following command to start gulp:
gulp --max_old_space_size=8192

This command raises the maximum amount of memory that can be used by the gulp process to 8192 MB (about 8 GB). If your system has sufficient memory space, this method will eliminate the error.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top