Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native upgrade - pod install throws error for config = use_native_modules

I'm trying to upgrade my react native version to 0.68.2 from 0.66.3.

I have followed this.

If I try to run pod install, it throws:

error Cannot read properties of undefined (reading 'configurations').

[!] Invalid `Podfile` file: 859: unexpected token at 'TypeError: Cannot read properties of undefined (reading 'configurations')

info Run CLI with --verbose flag for more details.
'.

 #  from /Users/me/Documents/app/ios/Podfile:8
 #  -------------------------------------------
 #  target 'app' do
 >    config = use_native_modules!
 #    # Flags change depending on the env values.

Here's my package.json:

{
  "name": "app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "format": "yarn prettier -c '**/*.+(js|json|ts|tsx|md)'",
    "format:fix": "yarn prettier --write '**/*.+(js|json|ts|tsx|md)'",
    "typecheck": "tsc --noEmit",
    "commit": "git-cz",
    "generateTypes": "graphql-codegen",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest --runInBand --detectOpenHandles --forceExit",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
  },
  "dependencies": {
    "@apollo/client": "^3.6.5",
    "apollo-upload-client": "^17.0.0",
    "date-fns": "^2.28.0",
    "eventemitter3": "^4.0.7",
    "graphql": "^16.5.0",
    "i18next": "^21.8.5",
    "react": "18.1.0",
    "react-i18next": "^11.16.9",
    "react-native": "0.68.2",
    "react-native-encrypted-storage": "^4.0.2",
    "react-native-fast-image": "^8.5.11",
    "react-native-get-random-values": "^1.8.0",
    "react-native-image-picker": "^4.8.3",
    "react-native-keychain": "^8.0.0",
    "react-native-notification-sounds": "^0.5.4",
    "react-native-sound": "^0.11.2",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^12.3.0",
    "react-native-vector-icons": "^9.1.0",
    "react-redux": "^8.0.2",
    "react-router-native": "^5.3.2",
    "redux": "^4.2.0",
    "redux-thunk": "^2.4.1",
    "uuid": "^8.3.2",
    "victory-native": "^36.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.18.2",
    "@babel/preset-typescript": "^7.17.12",
    "@babel/runtime": "^7.18.3",
    "@graphql-codegen/add": "3.1.1",
    "@graphql-codegen/cli": "2.6.2",
    "@graphql-codegen/import-types-preset": "2.1.18",
    "@graphql-codegen/typescript": "2.4.11",
    "@graphql-codegen/typescript-operations": "2.4.0",
    "@graphql-codegen/typescript-react-apollo": "3.2.14",
    "@react-native-community/cli": "^8.0.2",
    "@react-native-community/eslint-config": "^3.0.2",
    "@testing-library/jest-native": "^4.0.5",
    "@testing-library/react-native": "^9.1.0",
    "@types/apollo-upload-client": "^17.0.0",
    "@types/jest": "^27.5.1",
    "@types/node": "^17.0.36",
    "@types/react": "^18.0.9",
    "@types/react-native": "^0.67.7",
    "@types/react-native-vector-icons": "^6.4.10",
    "@types/react-redux": "^7.1.24",
    "@types/react-router-native": "^5.1.3",
    "@types/react-test-renderer": "^18.0.0",
    "@types/uuid": "^8.3.4",
    "@typescript-eslint/eslint-plugin": "^5.26.0",
    "@typescript-eslint/parser": "^5.26.0",
    "babel-jest": "^28.1.0",
    "babel-plugin-transform-inline-environment-variables": "^0.4.4",
    "commitizen": "^4.2.4",
    "cz-conventional-changelog": "^3.3.0",
    "eslint": "^8.16.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-react": "^7.30.0",
    "eslint-plugin-react-hooks": "^4.5.0",
    "eslint-plugin-react-native": "^4.0.0",
    "flow-bin": "^0.179.0",
    "husky": "^8.0.1",
    "jest": "^28.1.0",
    "lint-staged": ">=12",
    "metro-react-native-babel-preset": "^0.71.0",
    "mockdate": "^3.0.5",
    "react-native-eject": "^0.1.2",
    "react-test-renderer": "18.1.0",
    "redux-devtools-extension": "^2.13.9",
    "ts-jest": "^28.0.3",
    "typescript": "^4.7.2"
  },
  "resolutions": {
    "@types/react": "18.x.x",
    "@types/react-dom": "18.x.x"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged",
      "prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
    }
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}

Running on M1, followed instructions how to pod install with m1, same issue.

Just to confirm it is working perfectly with 0.68.2.

What is the problem?

like image 227
Gergő Horváth Avatar asked Sep 01 '25 11:09

Gergő Horváth


1 Answers

In your dev dependencies you have:

    "@react-native-community/cli": "^8.0.2",

Version 8 is incompatible with React Native 0.68, if you look at the package.json for this version, you can see that the cli version is ^7.

You can either remove this as a direct dependency (probably best), or change your react native cli version to match what is expected in the package.json (7.0.3 as of this writing, but you can always check the actual file)

like image 156
Will Wheeler Avatar answered Sep 03 '25 01:09

Will Wheeler