Github Action gives my this error for the last "run: npm run build"
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Error: Process completed with exit code 1.
My workflow file
name: Node.js CI
on:
push:
branches: ['master']
jobs:
build:
runs-on: self-hosted
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm i
- run: npm i
working-directory: client
- run: npm run build --if-present
working-directory: client
I think this is the solution
env:
NODE_OPTIONS: "--max-old-space-size=4096"
But it didn't work yet im not sure i've to add "-" before the env and the exact position of it... I did it under "run: npm run build --if-present working-directory: client" but didn't work.
According to this response to a similar issue:
run
jobs:
make-love:
steps:
- name: "Just do it"
run: |
export NODE_OPTIONS="--max_old_space_size=4096"
npm start
env
jobs:
make-love:
steps:
- name: "Nothing is impossible"
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: npm start
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With