title: How can I fix bitbucket pipelines from crashing when running out of memory?
body: <p>I am trying to run the following pipeline in bitbucket pipelines for a salesforce SFRA project. It is working great until I add a couple more sites to our build setup. I have already added in the 2x and the docker memory of 7128. Are there any other ways to optimize this pipeline so it stops crashing? I also am not positive that the caches step is setup correctly. I had to hide most of the logs for security and privacy.</p>
  <p>Here is the error I am getting in the log. This error shows up on the <code>npm run compile:js:prod</code> step every time.</p>
  <pre><code>Killed
  npm ERR! code ELIFECYCLE
  npm ERR! errno 137
  </code></pre>
  <p>And here is my pipeline</p>
  <pre><code>image: node:10.18.0
  
  definitions:
    services:
      docker:
        memory: 7128
  pipelines:
    default:
      - step:
          caches:
            - node
          script:
            - npm install
            - npm test
    branches:
      develop:
        - step:
            name: Test Code
            script:
              - npm install
              - npm run lint
              - npm test
    custom:
      deployment-to-staging:
        - step:
            name: Test Code
            script:
              - npm install
              - npm run lint
              - npm test
        - step:
            name: Deploy To Staging
            deployment: staging
            size: 2x
            script:
              - npm install
              - npm run compile:svg
              - npm run compile:scss:prod
              - npm run compile:js:prod
              - npm run compile:fonts:prod
              - npm run deployCartridges &lt;options hidden&gt;
  </code></pre>