4

I only receive this error when building a CodePush release.

$appcenter codepush release-react -a APPNAME.com/APPNAME-ios -d Production --mandatory --output-dir ./build -t 1.x.x;

transform[stderr]: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
transform[stderr]: 
transform[stderr]: Writing Node.js report to file: report.20191010.093411.22661.001.json
transform[stderr]: Node.js report completed
transform[stderr]:  1: 0x100062df2 node::Abort() [/usr/local/bin/node]
transform[stderr]:  2: 0x1000634eb node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
transform[stderr]:  3: 0x1001aeda7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
transform[stderr]:  4: 0x1001aed44 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
transform[stderr]:  5: 0x1005b5bd2 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
transform[stderr]:  6: 0x1005b8103 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
transform[stderr]:  7: 0x1005b4638 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
transform[stderr]:  8: 0x1005b27f5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
transform[stderr]:  9: 0x1005bf09c v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
transform[stderr]: 10: 0x1005bf11f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
transform[stderr]: 11: 0x10058e314 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
transform[stderr]: 12: 0x100840c54 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
transform[stderr]: 13: 0x23da4894fc7d

How can I tell AppCenter to use max_old_space_size=8192 ?

1
  • 1
    Your export command has only one dash as I can see. Maybe try export NODE_OPTIONS=--max_old_space_size=8192 or NODE_OPTIONS="--max-old-space-size=8192" and see if it works? Commented Oct 10, 2019 at 9:17

4 Answers 4

1

this illustrates a solution to your issue.

On Android, add the following to the project's build.gradle file:

project.ext.react = [
nodeExecutableAndArgs: ["node", "--max_old_space_size=8192"]
]

On iOS, in Xcode, select your target and go to the Build Phases tab, in the section Bundle React Native code and images, add the flag to the shell script:

export NODE_BINARY="'node --max_old_space_size=8192'
../node_modules/react-native/packager/react-native-xcode.sh"

Hope this Helps!

Sign up to request clarification or add additional context in comments.

2 Comments

That's only for xcode. When I run appcenter CLI, I can't set the node memory there.
Can you please try running export NODE_MEMORY=8192 before running your code-push release-react command.
1

Add these to your scripts and then run them in order.

"setup-fix-memory-limit": "npm install -g increase-memory-limit",
"fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit",

Change the number in the second script to what ever you want.

npm run setup-fix-memory-limit
npm run fix-memory-limit

Also make sure to look at if it can be solved in another way, perhaps some incorrect imports are dramatically increasing the size of your bundle, use a bundle analyzer to see if what's in the build should be their, or if anything can be trimmed.

1 Comment

cross-env wont work with installation first npm.io/package/increase-memory-limit
0

A similar issue is discussed here. You could try to run this react-native bundle command :

node --expose-gc --max_old_space_size=8192 ./node_modules/react-native/local-cli/cli.js bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'

Comments

0

I got the same problem when running codepush on Bitrise. Solved by exporting it on CODE_PUSH_NODE_ARGS environment variable.

export CODE_PUSH_NODE_ARGS='--max_old_space_size=8192'

appcenter codepush release-react ...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.