facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.09k stars 24.19k forks source link

Yarn on 0.65 throws a heap out of memory error #32027

Closed ospfranco closed 2 years ago

ospfranco commented 3 years ago

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?

kelset commented 3 years ago

I tried npm install and that installs fine... so I guess yarn 1 is no longer supported?

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

manuhook commented 3 years ago

I have the same issue with yarn, I've tried removing node_modules and also yarn cache clean

<--- Last few GCs --->

[1900:0x1048d8000]   114707 ms: Scavenge (reduce) 4080.6 (4100.8) -> 4079.9 (4101.8) MB, 5.3 / 0.0 ms  (average mu = 0.149, current mu = 0.050) allocation failure 
[1900:0x1048d8000]   114722 ms: Scavenge (reduce) 4080.6 (4103.8) -> 4080.2 (4104.5) MB, 12.1 / 0.0 ms  (average mu = 0.149, current mu = 0.050) allocation failure 

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x101306bb5 node::Abort() (.cold.1) [/usr/local/bin/node]
 2: 0x1000ad6c9 node::Abort() [/usr/local/bin/node]
 3: 0x1000ad82f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
 4: 0x1001f1b97 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 5: 0x1001f1b33 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 6: 0x10039f695 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
 7: 0x1003a113a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
 8: 0x10039c865 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
 9: 0x10039a190 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
10: 0x1003a88ba v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x1003a8941 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
12: 0x100376712 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
13: 0x1006f64c8 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x100a7c3f9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
15: 0x100a63fad Builtins_SetConstructor [/usr/local/bin/node]
16: 0x100a11401 Builtins_JSBuiltinsConstructStub [/usr/local/bin/node]
17: 0x528b3c2b565 
18: 0x528b3c3284e 
19: 0x528b3c3adb9 
20: 0x100a15282 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
aprilmintacpineda commented 3 years ago

Have you found a solution yet? This is happening to me too, I tried the following:

Then I tried npx react-native init test and it worked

I use https://react-native-community.github.io/upgrade-helper/?from=0.64.2&to=0.65.0

huang-ju commented 3 years ago

I have the same issue with yarn

davidvorona commented 3 years ago

Also getting the same issue with yarn, on both OSX and Linux.

ospfranco commented 3 years ago

I tried npm install and that installs fine... so I guess yarn 1 is no longer supported?

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

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 fine

when 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

manuhook commented 3 years ago

when running yarn -verbose on my side

(...)
warning " > react-test-renderer@17.0.1" has incorrect peer dependency "react@17.0.1".
verbose 34.213907711 Selecting "react@17.0.2" at level 0 as the peer dependency of "react-shallow-renderer@16.14.1".
warning " > redux-flipper@1.4.2" has incorrect peer dependency "react-native@^0.63.0".
warning " > redux-flipper@1.4.2" has incorrect peer dependency "react-native-flipper@^0.63.0".
verbose 34.215225958 Selecting "redux@4.0.5" at level 0 as the peer dependency of "redux-flipper@1.4.2".

<--- Last few GCs --->

[4534:0x1048d8000]   140805 ms: Scavenge (reduce) 4081.7 (4100.8) -> 4081.1 (4101.8) MB, 3.7 / 0.0 ms  (average mu = 0.171, current mu = 0.073) allocation failure 
[4534:0x1048d8000]   140839 ms: Scavenge (reduce) 4081.7 (4103.8) -> 4081.3 (4104.3) MB, 32.2 / 0.0 ms  (average mu = 0.171, current mu = 0.073) allocation failure 

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
(...)
manuhook commented 3 years ago

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",
kelset commented 3 years ago

@manuhook interesting, what did you have before those? I can see in the template that we set

    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "metro-react-native-babel-preset": "^0.66.0",

And folks seem to report that on fresh-ly init'd projects those deps work fine 🤔

manuhook commented 3 years ago

@kelset I had this for rn 0.64.2

"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"metro-react-native-babel-preset": "^0.64.0",
davidvorona commented 3 years ago

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.

aprilmintacpineda commented 3 years ago

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",

This is actually what's on my package.json, but still fails.

"dependencies": {
  "@react-native-community/masked-view": "^0.1.11",
  "@react-native-community/netinfo": "^6.0.0",
  "@react-native-firebase/analytics": "^12.6.1",
  "@react-native-firebase/app": "^12.6.1",
  "@react-native-firebase/crashlytics": "^12.6.1",
  "@react-native-firebase/messaging": "^12.6.1",
  "@react-navigation/bottom-tabs": "^6.0.5",
  "@react-navigation/drawer": "^6.1.4",
  "@react-navigation/native": "^6.0.2",
  "@react-navigation/stack": "^6.0.7",
  "color": "^4.0.1",
  "date-fns": "^2.23.0",
  "expo-image-picker": "^10.2.2",
  "fluxible-js": "^5.0.11",
  "hermes-engine": "0.7.2",
  "husky": "7.0.1",
  "jsc-android": "^250230.2.1",
  "patch-package": "^6.4.7",
  "postinstall-postinstall": "^2.1.0",
  "react": "17.0.2",
  "react-fluxible": "^5.0.4",
  "react-native": "0.64.2",
  "react-native-add-calendar-event": "^4.0.0",
  "react-native-animatable": "^1.3.3",
  "react-native-background-timer": "^2.4.1",
  "react-native-bootsplash": "^3.2.4",
  "react-native-bouncy-checkbox": "^2.1.3",
  "react-native-camera-kit": "^11.2.1",
  "react-native-config": "^1.4.3",
  "react-native-device-info": "^8.3.0",
  "react-native-fs": "^2.18.0",
  "react-native-gesture-handler": "^1.10.3",
  "react-native-google-places": "^3.1.2",
  "react-native-maps": "^0.28.0",
  "react-native-mime-types": "^2.3.0",
  "react-native-modalize": "^2.0.8",
  "react-native-paper": "^4.9.2",
  "react-native-permissions": "^3.0.5",
  "react-native-portalize": "^1.0.7",
  "react-native-push-notification-popup": "^1.6.0",
  "react-native-qrcode-svg": "^6.1.1",
  "react-native-reanimated": "^2.2.0",
  "react-native-responsive-image-view": "^2.1.0",
  "react-native-safe-area-context": "^3.3.0",
  "react-native-screens": "^3.5.0",
  "react-native-sensitive-info": "^6.0.0-alpha.8",
  "react-native-svg": "^12.1.1",
  "react-native-unimodules": "^0.14.6",
  "react-native-vector-icons": "^8.1.0",
  "react-native-walkthrough-tooltip": "^1.2.0",
  "rn-placeholder": "^3.0.3",
  "uuid": "^8.3.2"
},
"devDependencies": {
  "@babel/core": "^7.15.0",
  "@babel/eslint-parser": "^7.15.0",
  "@babel/runtime": "^7.15.3",
  "@react-native-community/eslint-config": "^3.0.0",
  "babel-jest": "^27.0.6",
  "babel-plugin-module-resolver": "^4.0.0",
  "babel-plugin-optional-require": "^0.3.1",
  "babel-plugin-transform-remove-console": "^6.9.4",
  "command-line-args": "^5.2.0",
  "eslint": "^7.32.0",
  "eslint-import-resolver-babel-module": "^5.3.1",
  "eslint-plugin-import": "^2.24.0",
  "eslint-plugin-module-resolver": "^1.4.0",
  "eslint-plugin-react-hooks": "^4.2.0",
  "jest": "^27.0.6",
  "lint-staged": "^11.1.2",
  "metro-react-native-babel-preset": "^0.66.2",
  "prettier": "^2.3.2",
  "react-native-version": "^4.0.0",
  "react-test-renderer": "17.0.2",
  "source-map": "^0.7.3"
},

EDIT:

I just tried it again, and it worked

douglasndm commented 3 years ago

@kelset I had this for rn 0.64.2

"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"metro-react-native-babel-preset": "^0.64.0",

Thanks, I had the same problem on Windows and I was able to fix with this

aprilmintacpineda commented 3 years ago

does anyone else experience this? https://github.com/facebook/react-native/issues/32044

macfanatic commented 3 years ago

Following these suggested steps I get an error in metro itself immediately upon requesting index.js for iOS or Android:

error: index.js: Unknown option: .cloneInputAst. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.

I've tried using react-native start --reset-cache for metro itself, but doesn't seem to make any difference.

hahtml commented 3 years ago

Following these suggested steps I get an error in metro itself immediately upon requesting index.js for iOS or Android:

error: index.js: Unknown option: .cloneInputAst. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.

I've tried using react-native start --reset-cache for metro itself, but doesn't seem to make any difference.

This issue happens to me as well

alexsegura commented 3 years ago

Here I had to bump @react-native-community/eslint-config to ^3.0.0, and remove yarn.lock

chungweileong94 commented 2 years ago

Here I had to bump @react-native-community/eslint-config to ^3.0.0, and remove yarn.lock

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.

HilSny commented 2 years ago

I wanted to indicate what helped for us. We were using a custom hermes-engine version versus the one that is built into RN (there was a bug that occurred that required us to use this strategy).

I was having the exact same issue as stated above and all my depdencies were correct per other posters. However I discovered that we were behind in our hermes version. Upgrading hermes-engine to the version that supports 65 (0.8.1) allowed us to yarn without having to delete the yarn lock.

ospfranco commented 2 years ago

it doesn't look like a solution is coming soon from the RN team, because this is a conflict with some previous state of yarn.lock... so I'm just going to close it, since the workaround is clear. Update your dependencies mix/match, at some point your build should unlock itself.

macfanatic commented 2 years ago

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 get yarn install to work with different versions here, but I end up with errors when compiling via metro itself after the app boots.

{
  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.65.1"
  },
  "devDependencies": {
    "@babel/core": "7.12.9",
    "react-native-codegen": "^0.0.7"
  }
}

Screen Shot 2021-11-02 at 11 07 54 AM

valdio commented 2 years ago

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 get yarn install to work with different versions here, but I end up with errors when compiling via metro itself after the app boots.

{
  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.65.1"
  },
  "devDependencies": {
    "@babel/core": "7.12.9",
    "react-native-codegen": "^0.0.7"
  }
}

Screen Shot 2021-11-02 at 11 07 54 AM

Thank @macfanatic this saved me a lot of debugging time.

macfanatic commented 2 years ago

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 get yarn install to work with different versions here, but I end up with errors when compiling via metro itself after the app boots.

{
  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.65.1"
  },
  "devDependencies": {
    "@babel/core": "7.12.9",
    "react-native-codegen": "^0.0.7"
  }
}

Screen Shot 2021-11-02 at 11 07 54 AM

Thank @macfanatic this saved me a lot of debugging time.

In the end the suggestion to force resolve to babel 7.12.x is the only thing that has allowed me to run yarn install and actually run metro without errors. Insane that this has taken so so so many hours to figure out.

https://github.com/oblador/react-native-vector-icons/issues/1334#issuecomment-862148812

ferrannp commented 2 years ago

You need exactly these two versions:

"@babel/core": "7.12.9",
"@babel/runtime": "7.12.5",

Then yarn start --reset-cache. Try to always match the versions in the template.

macfanatic commented 2 years ago

You need exactly these two versions:

"@babel/core": "7.12.9",
"@babel/runtime": "7.12.5",

Then yarn start --reset-cache. Try to always match the versions in the template.

Matching the template is definitely my goal, but didn't work for our project. yarn start --reset-cache would never run, because just a simple yarn install first required, failed. Perhaps it works for others, this was definitely the most problematic upgrade to this roughly 4 year old RN project from a dependency standpoint.

coolguy001tv commented 2 years ago

At the beginning, rn 0.64.2 with the package.json below is ok for me:

"react-native": "0.64.2",
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"metro-react-native-babel-preset": "^0.64.0"

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:

"react-native": "0.67.0-rc.6",
"@babel/core": "^7.16.5",
"@babel/runtime": "^7.16.5",
"metro-react-native-babel-preset": "^0.66.2"
fdobre commented 2 years ago

The fix suggested by @coolguy001tv

 "@babel/core": "^7.16.5",
 "@babel/runtime": "^7.16.5",

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 from 0.64.2 to 0.67.3

These dependency updates should be listed in the react native upgrade helper.