Closed AngelDev0329 closed 1 year ago
@AngelDev727 It's not a bit clear where this issue is reproduced. However from what I see in the error it seems to be caused by NodeJS that runs out of memory. The V8 Engine by default presumes that one process needs around 2 GB of memory on 64bit systems (depending on the Node runtime version) which is sufficient for most cases. So from my point of view it's not Yarn Package's reponsibility to administer it. Here's the NODE docs to get a better grasp of it - V8 Options.
Fortunately, if you need more memory to be allocated by Node for your process, you have an option for that:
NODE_OPTIONS=--max-old-space-size=<size in MB>
.
This script can help you learn your Node Memory Limits:
const v8 = require(v8);
const totalHeapSize = v8.getHeapStatistics().total_available_size
let totalHeapSizeinGB = (totalHeapSize / 1024 / 1024 / 1024).toFixed(2)
console.log('Total heap size (bytes) ${totalHeapSize}, (GB ~${totalHeapSizeInGB})')
BEFORE calling your yarn install
or yarn build
command, run in the terminal:
export NODE_OPTIONS=--max-old-space-size=<size in MB>
set NODE_OPTIONS=--max-old-space-size=<size in MB>
For example,
$ export NODE_OPTIONS=--max-old-space-size=8192 $ yarn install
OR
$ export NODE_OPTIONS=--max-old-space-size=8192 && yarn install
If you want to set a new Node Memory Limit for the whole project, you can do it on the IDE level.
For example, for VS Code you will want to create a settings file in the project root .vscode/settings.json
with the following content:
{
"terminal.integrated.env.windows": { // depending on your OS it can be "linux" or "osx"
"node_options": "--max_old_space_size=8192"
}
}
Include ENV NODE_OPTIONS="--max-old-space-size=8192"
in your Dockerfile
env:
- name: MEMORY_LIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
- name: NODE_OPTIONS
value: "--max-old-space-size=$(MEMORY_LIMIT)"
@AngelDev727 Please let me know if it fixes it.
cc @bestander @sebmck @arcanis
I solved this problem. In fact, I changed only expo version, not other libraries. So I have corrected to original version. It works as well.
@AngelDev727 what version of expo did you change to?
@AngelDev727
@AngelDev727 what version of expo did you change to?
the same question
[1/4] 🔍 Resolving packages... warning expo > @expo/cli > cacache > @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... warning " > @alessiocancian/react-native-actionsheet@3.2.0" has unmet peer dependency "prop-types@>=15.4.0". warning "expo-camera > @koale/useworker@4.0.2" has incorrect peer dependency "react@^16.8.0". warning "react-native > react-native-codegen > jscodeshift@0.11.0" has unmet peer dependency "@babel/preset-env@^7.1.6". warning " > react-native-actionsheet@2.4.2" has unmet peer dependency "prop-types@>=15.4.0". warning " > react-native-iap@8.6.7" has incorrect peer dependency "react-native@>=0.65.1". warning " > react-native-iaphub@6.3.0" has incorrect peer dependency "react-native-iap@5.2.6". warning " > react-native-modal-datetime-picker@13.1.2" has incorrect peer dependency "react-native@>=0.65.0". warning " > rn-pdf-reader-js@4.1.1" has incorrect peer dependency "expo@>= 33.0.x < 37.0.x". warning " > rn-pdf-reader-js@4.1.1" has incorrect peer dependency "expo-constants@>= 5.0.0 < 9.x". warning " > rn-pdf-reader-js@4.1.1" has incorrect peer dependency "expo-file-system@>= 5.0.0 < 9.x". warning " > rn-pdf-reader-js@4.1.1" has incorrect peer dependency "react@16.x". warning " > rn-pdf-reader-js@4.1.1" has incorrect peer dependency "react-native-webview@>= 7.0.5 < 8.x".
<--- Last few GCs --->
[1130:0x7fdbb8008000] 179956 ms: Scavenge 4036.2 (4116.5) -> 4034.0 (4119.0) MB, 27.7 / 0.0 ms (average mu = 0.388, current mu = 0.225) allocation failure [1130:0x7fdbb8008000] 180067 ms: Scavenge 4039.4 (4119.0) -> 4036.7 (4137.0) MB, 98.7 / 0.0 ms (average mu = 0.388, current mu = 0.225) allocation failure [1130:0x7fdbb8008000] 181491 ms: Mark-sweep 4049.4 (4137.0) -> 4041.4 (4146.0) MB, 1388.6 / 0.0 ms (average mu = 0.325, current mu = 0.182) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory 1: 0x10d689205 node::Abort() (.cold.1) [/usr/local/bin/node] 2: 0x10c38a4d9 node::Abort() [/usr/local/bin/node] 3: 0x10c38a64f node::OnFatalError(char const, char const) [/usr/local/bin/node] 4: 0x10c4fdb07 v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, bool) [/usr/local/bin/node] 5: 0x10c4fdaa3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, bool) [/usr/local/bin/node] 6: 0x10c6a1785 v8::internal::Heap::FatalProcessOutOfMemory(char const) [/usr/local/bin/node] 7: 0x10c6a010c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node] 8: 0x10c6ac9b0 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node] 9: 0x10c6aca31 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node] 10: 0x10c679ac7 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node] 11: 0x10ca315be v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long, v8::internal::Isolate*) [/usr/local/bin/node] 12: 0x10cdda319 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node] zsh: abort yarn