How to fix “FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory” error

前端 未结 6 527
再見小時候
再見小時候 2020-12-15 17:52

I\'m trying to deploy a reactjs application to heroku. While compiling assets, the build fails and produces this error:

-----> Ruby app detected
----->         


        
6条回答
  •  猫巷女王i
    2020-12-15 18:40

    The root cause of the issue is due to large source file sizes.
    If the underline problem is within your source code you can resolve it by simply increasing the Node Heap Size as below,

    "start": "react-scripts --max_old_space_size=4096 start",
    "build": "react-scripts --max_old_space_size=4096 build",
    But if the problem lies within any dependencies introduced, we may need to increase the Node Heap allocation globally to resolve the issue.

    For Windows:

    set NODE_OPTIONS=--max_old_space_size=4096
    

    For Linux:

    export NODE_OPTIONS=--max_old_space_size=4096
    

提交回复
热议问题