Build failing on one of two identical branches

I have a vue (nuxt) project with a fairly simple CI script to build (npm install, npm run build) and a manual step for deploy. The build step works in master but not in develop (or it seems any other branch). I tried clearing runner caches, same result. I created a branch through gitlab UI from a working master, with no changes, and it fails.

> nuxt build
[140](#L140)[fatal] Maximum call stack size exceeded
[141](#L141) at RegExp.exec (<anonymous>)
[142](#L142) at node_modules/@nuxt/config/dist/config.js:4661:52
[143](#L143) at Array.reduce (<anonymous>)
[144](#L144) at interpolate (node_modules/@nuxt/config/dist/config.js:4660:26)
[145](#L145) at node_modules/@nuxt/config/dist/config.js:4676:17
[146](#L146) at Array.reduce (<anonymous>)
[147](#L147) at interpolate (node_modules/@nuxt/config/dist/config.js:4660:26)
[148](#L148) at node_modules/@nuxt/config/dist/config.js:4676:17
[149](#L149) at Array.reduce (<anonymous>)
[150](#L150) at interpolate (node_modules/@nuxt/config/dist/config.js:4660:26)

Using GitLab.com, here’s my gitlab-ci.yml:

image: docker:latest

services:
  - docker:dind

stages:
  - build
  - deploy

variables:
  # Common (?)
  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
  AWS_REGION: $AWS_REGION
  S3_BUCKET_NAME: $S3_BUCKET_NAME
  CDN_DISTRIBUTION_ID: $CDN_DISTRIBUTION_ID

cache:
  key: $CI_COMMIT_REF_SLUG
  paths:
    - node_modules/

######################
##   BUILD STAGE    ##
######################

Build:
  stage: build
  image: node:12
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - dist/
    expire_in: 1 day

######################
##   DEPLOY STAGE   ##
######################

Deploy:
  stage: deploy
  image: python:latest
  when: manual
  script:
    - pip install awscli
    - aws s3 cp dist/ s3://$S3_BUCKET_NAME/ --recursive --include "*"
    - aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths "/*"

I’m also able to build locally. Any help would be greatly appreciated.