Build Failing for CapCut Website on Travis CI Due to Asset Minification Errors

Hi everyone,

I’m facing an issue with the Travis CI build pipeline for my website related to CapCut. The build fails during the deployment stage, specifically when running the asset minification process. The error log shows:

Error: JavaScript heap out of memory  
npm ERR! code ELIFECYCLE  
npm ERR! errno 1

I’m using a Node.js-based static site generator (Gatsby), and the pipeline runs fine locally. The travis.yml file includes the following configurations:

language: node_js  
node_js:  
  - 18  
install:  
  - npm ci  
script:  
  - npm run build

I’ve tried increasing the memory limit using NODE_OPTIONS=--max_old_space_size=4096, but the error persists.

Does anyone know how I can resolve this issue or optimize the pipeline to handle larger builds? Could it be related to Travis CI’s resource limitations? Any insights would be greatly appreciated!

Thanks in advance for your help!

Is there anyone?

Is there anyone please help me as I am not a technical person ???

Hi @joedeen4,

I’ve put together a .travis.yml for you that includes adjustments to increase memory allocation, specify a more powerful build instance, and handle the Gatsby build process efficiently:

language: node_js
node_js:
  - 18

jobs:
  include:
    - stage: install_dependencies
      name: "Install Dependencies"
      script:
        - npm ci

    - stage: build
      name: "Build Gatsby Site"
      resource_class: large 
      script:
        - export NODE_OPTIONS=--max_old_space_size=8192 
        - npm run build

    - stage: deploy
      name: "Deploy to Production"
      script:
        - npm install -g netlify-cli 
        - netlify deploy --prod --dir=public --auth=$NETLIFY_AUTH_TOKEN

cache:
  directories:
    - node_modules

env:
  global:
    - NETLIFY_AUTH_TOKEN=your_netlify_auth_token

You can use a more powerful instance by specifying the resource_class option:

jobs:
  include:
    - stage: build
      resource_class: large
      script:
        - NODE_OPTIONS=--max_old_space_size=8192 npm run build

I hope this helps.