react-native: Yarn on 0.65 throws a heap out of memory error
Description
I’m trying to upgrade to 0.65 from 0.64.2, I updated the code based on the upgrade helper, however when I try to run yarn
to install the dependencies nothing happens for a while and then I get a heap out of memory error…
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x1009dcfe4 node::Abort() [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
2: 0x1009dd164 node::errors::TryCatchScope::~TryCatchScope() [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
3: 0x100af65dc v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
4: 0x100af6570 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
5: 0x100c7dea4 v8::internal::Heap::CollectionBarrier::Wait() [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
6: 0x100c7f5c4 v8::internal::Heap::HasLowYoungGenerationAllocationRate() [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
7: 0x100c7b9d8 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
8: 0x100c795ac v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
9: 0x100c861bc v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
10: 0x100c8624c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
11: 0x100c5a718 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
12: 0x100f6f650 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
13: 0x101279b8c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
14: 0x10127abc0 Builtins_StringAdd_CheckNone [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
15: 0x1052a8e38
16: 0x10120b6a4 Builtins_ArgumentsAdaptorTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
17: 0x1052aa624
18: 0x10534c044
19: 0x105359318
20: 0x1012128d4 Builtins_InterpreterEntryTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
21: 0x1012128d4 Builtins_InterpreterEntryTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
22: 0x10120b6a4 Builtins_ArgumentsAdaptorTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
23: 0x1012128d4 Builtins_InterpreterEntryTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
24: 0x1012421dc Builtins_GeneratorPrototypeNext [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
25: 0x105377a00
26: 0x1050a343c
27: 0x10120b6a4 Builtins_ArgumentsAdaptorTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
28: 0x1012128d4 Builtins_InterpreterEntryTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
29: 0x10120b6a4 Builtins_ArgumentsAdaptorTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
30: 0x1012128d4 Builtins_InterpreterEntryTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
31: 0x1012421dc Builtins_GeneratorPrototypeNext [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
32: 0x105377a00
33: 0x1050a343c
34: 0x10120b6a4 Builtins_ArgumentsAdaptorTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
35: 0x1012128d4 Builtins_InterpreterEntryTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
36: 0x10120b6a4 Builtins_ArgumentsAdaptorTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
37: 0x1012128d4 Builtins_InterpreterEntryTrampoline [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
38: 0x1012421dc Builtins_GeneratorPrototypeNext [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
39: 0x10537996c
40: 0x1012bac9c Builtins_PromiseFulfillReactionJob [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
41: 0x101232ad8 Builtins_RunMicrotasks [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
42: 0x101210068 Builtins_JSRunMicrotasksEntry [/Users/osp/.nvm/versions/node/v14.17.1/bin/node]
43: 0x160008000
zsh: abort yarn
Environment
Running on a m1 air with 16gb of ram, I also tried clearing my node_modules and using a different node version (16)
Here is a partial package.json:
{
"moduleRoots": [
"./"
],
"scripts": {
...
},
"dependencies": {
"@delightfulstudio/react-native-wheel-picker-android": "^2.1.3",
"@hmscore/react-native-hms-analytics": "^5.0.1-300",
"@hmscore/react-native-hms-iap": "^5.0.0",
"@invertase/react-native-apple-authentication": "^1.1.2",
"@react-native-community/async-storage": "^1.6.1",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/netinfo": "^4.1.5",
"@react-native-community/picker": "^1.6.5",
"@react-native-community/push-notification-ios": "1.8.0",
"@react-native-community/slider": "^2.0.9",
"@react-native-firebase/analytics": "12.4.0",
"@react-native-firebase/app": "12.4.0",
"@react-native-firebase/auth": "12.4.0",
"@react-native-firebase/crashlytics": "12.4.0",
"@react-native-firebase/database": "12.4.0",
"@react-native-firebase/dynamic-links": "12.4.0",
"@react-native-firebase/in-app-messaging": "12.4.0",
"@react-native-firebase/messaging": "12.4.0",
"@react-native-firebase/remote-config": "12.4.0",
"@react-native-google-signin/google-signin": "^6.0.0",
"@sentry/react-native": "2.6.0",
"d3-array": "^2.4.0",
"d3-scale": "^3.2.1",
"d3-shape": "^1.3.7",
"emoji-regex": "^9.2.0",
"final-form": "^4.20.1",
"final-form-arrays": "^3.0.2",
"global": "^4.3.2",
"iap-receipt-validator": "^1.0.6",
"immer": "^6.0.9",
"lodash": "^4.17.4",
"lottie-ios": "3.1.8",
"lottie-react-native": "^3.5.0",
"luxon": "^1.19.3",
"markdown-it-container": "^3.0.0",
"moize": "^5.4.4",
"moment-duration-format": "^2.2.2",
"moment-timezone": "^0.5.14",
"nullthrows": "1.1.1",
"number-to-locale-string-polyfill": "^1.0.9",
"patch-package": "^6.2.2",
"postinstall-postinstall": "^2.1.0",
"react": "17.0.2",
"react-final-form": "^6.5.1",
"react-final-form-arrays": "^3.1.2",
"react-native": "0.65.0",
"react-native-androw": "^0.0.33",
"react-native-animatable": "^1.3.3",
"react-native-appsflyer": "6.3.20",
"react-native-build-config": "^0.3.2",
"react-native-calendars": "^1.212.0",
"react-native-collapsible": "^1.5.1",
"react-native-confetti-cannon": "^1.2.0",
"react-native-config": "1.3.1",
"react-native-date-picker": "^3.2.10",
"react-native-device-info": "^2.3.2",
"react-native-elements": "1.1.0",
"react-native-fast-image": "^8.3.3",
"react-native-fbsdk": "3.0.0",
"react-native-gesture-handler": "1.10.3",
"react-native-i18n": "^1.0.0",
"react-native-iap": "^6.2.4",
"react-native-in-app-utils": "6.1.0",
"react-native-keyboard-aware-scroll-view": "https://github.com/APSL/react-native-keyboard-aware-scroll-view#v0.9.2",
"react-native-linear-gradient": "^2.5.6",
"react-native-looped-carousel": "^0.1.13",
"react-native-markdown-display": "^6.1.6",
"react-native-markdown-renderer": "^3.2.6",
"react-native-modal-datetime-picker": "^8.6.0",
"react-native-permissions": "^2.2.0",
"react-native-push-notification": "7.4.0",
"react-native-reanimated": "1.13.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "2.17.1",
"react-native-scrollable-tab-view": "git+https://github.com/compojoom/react-native-scrollable-tab-view.git#fixes_android",
"react-native-shared-group-preferences": "^1.1.19",
"react-native-simple-toast": "^1.1.2",
"react-native-snackbar": "^2.0.2",
"react-native-splash-screen": "^3.2.0",
"react-native-star-rating": "^1.0.8",
"react-native-store-review": "0.2.0",
"react-native-svg": "^12.1.0",
"react-native-tab-view": "^2.14.2",
"react-native-vector-icons": "7.0.0",
"react-native-webp-format": "1.1.2",
"react-navigation": "4.4.3",
"react-navigation-hooks": "^1.1.0",
"react-navigation-redux-helpers": "^4.0.1",
"react-navigation-stack": "2.10.4",
"react-navigation-tabs": "^2.11.0",
"react-redux": "^7.1.1",
"react-static-container": "^1.0.1",
"reanimated-bottom-sheet": "^1.0.0-alpha.20",
"recompose": "0.30.0",
"redux": "^3.6.0",
"redux-persist": "^6.0.0",
"redux-saga": "^0.14.6",
"rn-apple-healthkit": "^0.8.0",
"seamless-immutable": "^7.1.2",
"simplify-js": "^1.2.4"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@babel/traverse": "7.1.6",
"@babel/types": "7.2.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^26.6.3",
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.7.0",
"es6-promise-pool": "^2.5.0",
"eslint": "7.25.0",
"eslint-plugin-flowtype": "5.7.2",
"flow-bin": "^0.149.0",
"flow-typed": "^3.2.0",
"husky": "^3.0.5",
"jest": "^25.1.0",
"jetifier": "^1.6.4",
"metro-react-native-babel-preset": "^0.66.0",
"react-native-codegen": "^0.0.7",
"pod-install": "^0.1.26",
"react-dom": "^16.6.3",
"react-native-svg-transformer": "^0.14.3",
"react-test-renderer": "17.0.2",
"redux-logger": "^3.0.6",
"redux-mock-store": "^1.2.3",
"snazzy": "^7.0.0",
"standard": "16.0.3"
},
"resolutions": {
"flow-typed/semver": "7.1.3"
},
"jest": {
"preset": "react-native",
"transform": {
"^.+\\.js$": "babel-jest",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/Tests/fileTransformer.js"
},
"setupFiles": [
"<rootDir>/Tests/setupTests.js"
],
"transformIgnorePatterns": [
"node_modules/(?!react-navigation)/"
],
"testPathIgnorePatterns": [
"webapp/",
"firebase/"
],
"testEnvironment": "node",
"moduleNameMapper": {
"\\.svg": "<rootDir>/__mocks__/svgMock.js"
}
},
"standard": {
"parser": "babel-eslint",
"plugins": [
"flowtype"
],
"env": [
"jest"
],
"globals": [
"fetch",
"navigator",
"__DEV__",
"XMLHttpRequest",
"FormData",
"$Keys",
"$Values",
"$Diff",
"$ReadOnly",
"$ReadOnlyArray",
"$Shape",
"$Exact",
"requestAnimationFrame",
"Generator"
],
"ignore": [
"/flow-typed/",
"/flow/libs/tcomb.js",
"/webapp/",
"/firebase/",
"/scripts"
]
},
"config": {},
"husky": {
"hooks": {
"pre-push": "yarn check-flow-lint || exit 0"
}
}
}
Edit
I tried npm install
and that installs fine… so I guess yarn 1 is no longer supported?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 27 (3 by maintainers)
Commits related to this issue
- fix: react native 0.65.1 yarn install 오류 수정 - https://github.com/facebook/react-native/issues/32027 — committed to jiggag/react-native-starter by jiggag 3 years ago
Ok its working with yarn and rn 0.65 if you update your devDependencies like that :
Can confirm, updating devDependencies as @manuhook suggests fixed the issue for me. It’s worth stating that once changes were made to the
yarn.lock
, I was able to revert those devDependencies back to their original state and everything continues to install correctly. This lends to the behavior others are seeing, which is that fresh projects aren’t getting this same error.@kelset I had this for rn 0.64.2
At the beginning, rn 0.64.2 with the package.json below is ok for me:
but after upgrading rn to 0.67.0-rc.6, then i met the out of memory error. Finally I find upgrading those dependecies help me get out of this error:
I tried a fresh project and there it is working, I even copied my package.json section by section trying to see if something would fail, then started copying other files, like my patches from
patch-package
,react-native.config.js
, until eventually copying all the source code (src, ios, android, etc) and nothing, on a fresh project it works finewhen running yarn --verbose here is the output
https://pastebin.com/uj1HfLWT
Seems to hang always at the eslint-plugin dependency, after removing yarn.lock and installing fresh it works
Removing
yarn.lock
is always a bad solution, even though 99% of the time it will fix the issue, but for existing projects with a large number of dependencies might break.I have the same issue with yarn, I’ve tried removing node_modules and also yarn cache clean
The fix suggested by @coolguy001tv
worked for me to fix
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
that showed up when upgrading from0.64.2
to0.67.3
These dependency updates should be listed in the react native upgrade helper.
I ended up removing all dependencies to just these 4, and the culprit for us was
@babel/core
preventing us from installing. I was able to getyarn install
to work with different versions here, but I end up with errors when compiling via metro itself after the app boots.Here I had to bump
@react-native-community/eslint-config
to^3.0.0
, and removeyarn.lock
This is actually what’s on my
package.json
, but still fails.EDIT:
I just tried it again, and it worked
I use yarn v1 on my machine and I don’t hit that issue - maybe try to clean up some yarn caches? It’s a weird one for sure. Does it also happen for you on a fresh-ly init’d project? A repro would really help