0

I am building GitLab CI/CD pipeline using the docker nodejs image provided by my company. and also the gitlab group runner provided by my company.
When job runs npm install command we get the following error

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory

or

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

quick online search suggest to increase the memory with NODE_OPTIONS="--max-old-space-size=8192"

here is the pipeline job. I have tried different syntax with no luck

build-job:       
  image: "docker.mycomapy-images/nodejs:14"
  stage: build
  script:
    - node -v
    #- export NODE_OPTIONS=--max_old_space_size=8192
    #- export NODE_OPTIONS="--max-old-space-size=8192"
    #- node --max-old-space-size=8192 `which npm` install
    - export NODE_OPTIONS='--max-old-space-size=8192'
    - npm install
    - npm run build:prod

other option suggested was to set in package.json. "scripts": { "start": "cross-env NODE_OPTIONS=--max-old-space-size=8192 webpack" }

none of the above options worked.

Can this be issue with runner itself? The runner I am using is AWS EC2 t3a.micro instance. I believe the memory size on such instance is 1 GB. So I think NODE_OPTIONS will have no effect.

However, On the same runner, I was able to build if I change the image to official docker image image: node:14 and in this case I do not even need to set NODE_OPTIONS

I am not sure if this is a runner issue or image issue

Error message

enter image description here

LP13
  • 30,567
  • 53
  • 217
  • 400

1 Answers1

1

I believe this is a image issue, since official nodejs docker image is name just "node", not "nodejs"