question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Yarn on 0.65 throws a heap out of memory error

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:27 (1 by maintainers)

github_iconTop GitHub Comments

36reactions
manuhookcommented, Aug 18, 2021

Ok its working with yarn and rn 0.65 if you update your devDependencies like that :

"@babel/core": "^7.15.0",
"@babel/runtime": "^7.15.3",
"@react-native-community/eslint-config": "^3.0.0",
"metro-react-native-babel-preset": "^0.66.2",
4reactions
davidvoronacommented, Aug 18, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jobs fail in Yarn with out of Java heap memory error
We are running Yarn on CDH 5.1 with 14 nodes using 6 GB of memory. I understand this is not a log of...
Read more >
yarn build in ReactJS, Allocation failed - JavaScript heap out ...
Since we do the build locally on the machine that serves the build, it is rare to dedicate more than 1 or 2...
Read more >
How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
How to Fix JavaScript Heap Out of Memory on Windows · Open the Start menu, search for Advanced System Settings, and select the...
Read more >
Data Mining of Extremely Large Ad-hoc Data Sets to Produce ... - DTIC
To mitigate the out-of-memory error, we relate some environment variables with the Yet Another Resource Negotiator (YARN) architecture and provide some ...
Read more >
JavaScript Heap Out Of Memory Error - OpenReplay Blog
By default, Node.js has memory limits that prevent the program from consuming too much memory and crashing the whole system. The results differ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found