Amplify-cli: [WARNING]: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Created on 19 Mar 2020  路  4Comments  路  Source: aws-amplify/amplify-cli

Amplify CLI v4.16.0 && 4.16.1

Was having this issue before, with 4.13. The 4.16.0 update seemed to fix it but now it sprung back up. Getting this same error when running amplify publish locally, and during the auto-builds in Amplify Console.

pending-response pending-triage platform

Most helpful comment

If anyone comes here looking to build a JS frontend on Amplify, it seems that it comes from the difference in the way memory is handled by node v10 vs node v12.

Check how you can add nvm use $VERSION_NODE_12 to your build settings as explained by @atlesp here https://github.com/aws-amplify/amplify-console/issues/440#issuecomment-602626451
image

All 4 comments

At which point of the execution did you see the error message? Could you take a screenshot and share it here?
This might be tied to your frontend build command

I think this is an issue now with react-scripts, it is tied with the frontend build command. I'm sorry for asking about it here. I set the --max_old_space_size flag in my build script and seemed to fix it. Thanks for the quick response.

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts --max_old_space_size=8192 build",
    "test": "react-scripts test",
    "test:cov": "react-scripts test --coverage",
    "test:debug": "react-scripts --inspect-brk test --runInBand",
    "eject": "react-scripts eject"
  },

If anyone comes here looking to build a JS frontend on Amplify, it seems that it comes from the difference in the way memory is handled by node v10 vs node v12.

Check how you can add nvm use $VERSION_NODE_12 to your build settings as explained by @atlesp here https://github.com/aws-amplify/amplify-console/issues/440#issuecomment-602626451
image

@blazinaj your solution worked perfectly - thank you @charleslouis I'm sure that would have helped as well!

Was this page helpful?
0 / 5 - 0 ratings