Issue with Build Process: Exit Code 137 and Chunk Size Warning

Hello Frappe community,

I am encountering an issue during the build process of my Frappe application. When I run the build command, I receive the following warning and error:

  1. Warning:
    Some chunks are larger than 500 kB after minification. Consider using dynamic import() to code-split the application or adjust the chunk size limit.
  2. Error:
    After completing most of the build process, the system is being killed due to excessive resource usage with the error code 137. The specific error message is:

vbnet

CopyEdit

error Command failed with exit code 137.
  1. Additional Information:
  • The build completes in around 14 seconds before failing.
  • The issue seems to be related to large chunk sizes and possibly insufficient system resources.

Steps Taken:

  • Tried running the build multiple times, but the same error occurs each time.
  • I attempted to adjust configurations, but I don’t have direct access to the rollup or vite configuration files.
  • The system resources on the server show around 2.4GB of RAM usage, and the server is using a 4GB setup.

Environment:

  • Frappe version: (please specify the version you’re using)
  • Vite version: v4.5.5
  • Node.js version: (please specify)
  • Yarn version: (please specify)

Request for Help:

  • Could anyone provide insights on how to resolve the chunk size issue, or how to optimize the build process to avoid running out of memory?
  • Any suggestions on configurations or system optimizations to prevent the build process from being killed (exit code 137)?

Thank you in advance for your help!

A quick Google search of the error message suggests a Yarn out of memory error. More RAM or code optimization may be needed.

i have alot of memory

Is it possible to monitor memory use while building with the hosting setup?

Hi @Mohemd_Ali @smino:

I am not an experienced developer, but saw this before (at least chunk size issue … don’t know if both are related)
.
Try to configure your vite.config.js

add this to Build into defineConfig function

    minify: true,     // Enable minification
    chunkSizeWarningLimit: 1000,

Hope this helps.

Not sure what the hosting/development environment is…

how is that?

          total        used        free      shared  buff/cache   available

Mem: 125Gi 46Gi 5.0Gi 9.4Gi 74Gi 69Gi
Swap: 0B 0B 0B

Hi,

If you could describe the hosting environment and why you are unable to access your vite configuration directly. A change to that configuration may be needed to help with the problem.

i am working on production hosted on CloudCluster
, i can access to the vite.config
what should i do ?

Try the suggestion from @avc , above.

It may be that while your cloud instance has plenty of memory, there are limits that the app is allowed to access and that may need to be changed in the configuration.