Container 'Build' exceeded memory limit React
Asked by Paula Perret:

Hello, I'm having a hard time deploying my react app into production environment because it returns:

    yarn buildyarn run v1.22.19$ react-app-rewired buildCreating an optimised production build...The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.error Command failed with exit code 1.

I don't have any further information about what is causing the memory peak other than that log. This is my bitbucket pipeline file:

    image: atlassian/default-image:3pipelines:  branches:    stage: #STAGE        - step:            name: Build docker            deployment: Staging            services:              - docker            image: node:16-alpine            size: 2x            script:              - export NODE_OPTIONS=--max-old-space-size=8192              - yarn install              - yarn build              - echo $REACT_APP_AUTH              - echo $REACT_APP_MEMBERSHIP              - docker login -u $DOCKER_HUB_ID -p $DOCKER_HUB_PASSWORD              - docker build -t evoeccdocker/membership_front:stage --build-arg REACT_APP_AUTH=$REACT_APP_AUTH --build-arg REACT_APP_MEMBERSHIP=$REACT_APP_MEMBERSHIP --build-arg REACT_APP_PAYMENT=$REACT_APP_PAYMENT --build-arg REACT_APP_APPLICATION_ID=$REACT_APP_APPLICATION_ID --build-arg REACT_APP_APPLICATION_KEY=$REACT_APP_APPLICATION_KEY --build-arg REACT_APP_TINYMCE=$REACT_APP_TINYMCE --build-arg REACT_APP_GOOGLE_CLIENT_ID=$REACT_APP_GOOGLE_CLIENT_ID --build-arg REACT_APP_GOOGLE_ANALYTICS=$REACT_APP_GOOGLE_ANALYTICS --build-arg REACT_APP_PAYMENT_PAGE_STORAGE_ENCRYPT_SALT=$REACT_APP_PAYMENT_PAGE_STORAGE_ENCRYPT_SALT --build-arg REACT_APP_PAYPAL_CLIENT_ID=$REACT_APP_PAYPAL_CLIENT_ID -f ./Dockerfile-stage .              - docker push evoeccdocker/membership_front:stage            caches:              - docker              - nodecustom              - yarn    master: #MASTER        - step:            name: Build docker            image: node:16-alpine            size: 2x            deployment: Production            services:              - docker            script:              - export NODE_OPTIONS=--max-old-space-size=8192              - yarn install              - yarn build              - docker login -u $DOCKER_HUB_ID -p $DOCKER_HUB_PASSWORD              - docker build -t evoeccdocker/membership_front:prod --build-arg REACT_APP_AUTH=$REACT_APP_AUTH --build-arg REACT_APP_MEMBERSHIP=$REACT_APP_MEMBERSHIP --build-arg REACT_APP_PAYMENT=$REACT_APP_PAYMENT --build-arg REACT_APP_APPLICATION_ID=$REACT_APP_APPLICATION_ID --build-arg REACT_APP_APPLICATION_KEY=$REACT_APP_APPLICATION_KEY --build-arg REACT_APP_TINYMCE=$REACT_APP_TINYMCE --build-arg REACT_APP_GOOGLE_CLIENT_ID=$REACT_APP_GOOGLE_CLIENT_ID --build-arg REACT_APP_GOOGLE_ANALYTICS=$REACT_APP_GOOGLE_ANALYTICS --build-arg REACT_APP_PAYMENT_PAGE_STORAGE_ENCRYPT_SALT=$REACT_APP_PAYMENT_PAGE_STORAGE_ENCRYPT_SALT --build-arg REACT_APP_PAYPAL_CLIENT_ID=$REACT_APP_PAYPAL_CLIENT_ID -f ./Dockerfile-prod .              - docker push evoeccdocker/membership_front:prod            caches:              - docker              - nodecustom              - yarndefinitions:  caches:    nodecustom: ./node_modules    yarn: /usr/local/share/.cache/yarn

Does anyone know how to fix it or is there an easy way to discover which library or plugin is causing this peak of memory usage?


Answers:
author: Ste Wright
body: Hi [@Paula Perret](/t5/user/viewprofilepage/user-id/5474951)

Not sure if this is useful, but I found a similar question to this on the Community.

Does this answer help at all? - <https://community.atlassian.com/t5/Bitbucket-questions/Re-Container-Build-exceeded-memory-limit/qaq-p/2289638/comment-id/91040#M91040>

Ste


Tags: bitbucket-cloud

bitbucket-pipelines

cloud