Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.2K
Visualizações
Bitbucket Pipeline: Container 'Build' exceeded memory limit

I am trying to run a pipeline for my Angular App but when it comes to the "npm run build" part it crashes, the fail reason is "Container "Build" exceeded memory limit." I tried messing around with the memory settings in the yml file, for instance adding 'size 2x'and changing the memory amount assigned to docker.

bitbucket-pipelines.yml:

image: node:14.17.0

options:
 docker: true
 size: 2x

pipelines:
  custom:
    prod-deployment:
    - step:
        name: Build angular app
        #services:
        #  - docker
        caches:
        - node
        services:
        - docker
        size: 2x # Double resources available for this step.
        script:
        - mv .npmrc_config .npmrc
        - npm install --unsafe-perm
        - npm install -g @angular/cli@12.2.6
        - free -m
        - npm run dashboard:build
        - wget "censored for security"
        artifacts:
        - dist/**

    - step:
        name: Deploy artifacts using SCP to PROD
        deployment: production
        size: 2x # Double resources available for this step.
        script:
        - pipe: atlassian/scp-deploy:1.1.0
          variables:
            USER: $USERNAME
            SERVER: $SERVER
            REMOTE_PATH: 'Censored for Security'
            LOCAL_PATH: 'dist/*'

    dev-deployment:
    - step:
        name: Build angular app
        #services:
        #  - docker
        caches:
        - node
        services:
        - docker
        size: 2x # Double resources available for this step.
        script:
        - mv .npmrc_config .npmrc
        - npm install --unsafe-perm
        - npm install -g @angular/cli@12.2.6
        - free -m
        - npm run build
        - wget 'Censored for Security'
        artifacts:
        - dist/**

    - step:
        name: Deploy artifacts using SCP to PROD
        deployment: production
        size: 2x # Double resources available for this step.
        script:
        - pipe: atlassian/scp-deploy:1.1.0
          variables:
            USER: $USERNAME
            SERVER: $SERVER
            REMOTE_PATH: 'Censored for Security'
            LOCAL_PATH: 'dist/*'
            
definitions:
  services:
    docker:
      memory: 4096

Console error message:

Killed
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! build: `node --max_old_space_size=6144 node_modules/@angular/cli/bin/ng build --configuration=calio && npm run `
npm ERR! Exit status 137
npm ERR! 
npm ERR! Failed at the build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-10-14T08_40_46_012Z-debug.log
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Finally, I found a solution to this problem without reinstalling npm and I'm posting it because in future it will help someone, Most of the time this error occurs javascript heap went out of the memory. As the error says itself this is not a problem with npm. Only we have to do is

instead of, 'npm run build -prod'

extend the javascript memory by following,

node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda