Skip to content

A problem occurred evaluating script. > Command '[node, /Volumes/DATA/project_name/node_modules/@react-native-community/cli/build/bin.js, config, --platform, android]' failed with exit code 1. #2469

Closed

Description

@reactrahul1110

Ask your Question

I'm getting issue

FAILURE: Build failed with an exception.

  • Where:
    Script '/Volumes/DATA/LIVE_PROJECT/project_name/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 420

  • What went wrong:
    A problem occurred evaluating script.

Command '[node, /Volumes/DATA/LIVE_PROJECT/project_name/node_modules/@react-native-community/cli/build/bin.js, config, --platform, android]' failed with exit code 1.

Caused by: java.lang.Exception: Command '[node, /Volumes/DATA/LIVE_PROJECT/project_name/GIT/project_name/node_modules/@react-native-community/cli/build/bin.js, config, --platform, android]' failed with exit code 1.

"dependencies": {
"@expo/react-native-action-sheet": "4.0.1",
"@microsoft/signalr": "7.0.10",
"@pusher/pusher-websocket-react-native": "1.1.0",
"@react-native-async-storage/async-storage": "1.17.10",
"@react-native-community/cli-platform-android": "^14.0.0",
"@react-native-community/netinfo": "9.0.0",
"@react-native-community/push-notification-ios": "1.10.1",
"@react-native-firebase/app": "18.6.1",
"@react-native-firebase/crashlytics": "18.6.1",
"@react-native-firebase/messaging": "18.6.1",
"@react-native-google-signin/google-signin": "10.0.1",
"@react-navigation/bottom-tabs": "6.4.0",
"@react-navigation/material-bottom-tabs": "6.2.4",
"@react-navigation/native": "6.0.13",
"@react-navigation/stack": "6.3.2",
"@sanar/react-native-highlight-text": "1.0.2",
"@sentry/react-native": "4.6.1",
"@starling-tech/ripple-touchable": "0.1.5",
"axios": "0.27.2",
"moment": "2.29.4",
"react": "18.1.0",
"react-native": "0.70.2",
"react-native-azure-auth": "1.8.9",
"react-native-bootsplash": "4.3.0",
"react-native-calendars": "1.1290.0",
"react-native-cli": "^2.0.1",
"react-native-code-push": "7.0.5",
"react-native-config": "^1.5.1",
"react-native-country-codes-picker": "2.3.3",
"react-native-date-picker": "4.2.6",
"react-native-device-info": "10.9.0",
"react-native-document-picker": "9.0.1",
"react-native-dropdown-picker": "5.4.2",
"react-native-fast-image": "8.6.1",
"react-native-flash-message": "0.3.1",
"react-native-gesture-handler": "2.12.0",
"react-native-gifted-chat": "2.4.0",
"react-native-gradle-plugin": "^0.71.19",
"react-native-head-tab-view": "4.0.0-rc.13",
"react-native-image-crop-picker": "0.40.0",
"react-native-keyboard-aware-scroll-view": "0.9.5",
"react-native-keychain": "8.1.1",
"react-native-lightbox": "0.8.1",
"react-native-material-menu": "2.0.0",
"react-native-mime-types": "2.4.0",
"react-native-modal": "13.0.1",
"react-native-pager-view": "6.0.1",
"react-native-paper": "4.12.4",
"react-native-permissions": "3.8.4",
"react-native-push-notification": "8.1.1",
"react-native-reanimated": "2.14.4",
"react-native-safe-area-context": "4.5.1",
"react-native-screens": "3.20.0",
"react-native-svg": "13.3.0",
"react-native-tab-view": "3.5.2",
"react-native-tab-view-collapsible-header": "2.0.1",
"react-native-vector-icons": "10.0.0",
"react-native-video": "5.2.1",
"react-native-voip-push-notification": "^3.3.2",
"react-native-webview": "12.0.2",
"react-query": "3.39.2",
"react-signalr": "0.2.17",
"zustand": "4.3.9"
},
"devDependencies": {
"@babel/core": "7.12.9",
"@babel/runtime": "7.12.5",
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
"@react-native-community/eslint-config": "3.1.0",
"@rnx-kit/dep-check": "1.13.0",
"@tsconfig/react-native": "2.0.2",
"@types/jest": "26.0.23",
"@types/lodash": "4.14.182",
"@types/react-native": "0.69.3",
"@types/react-native-vector-icons": "6.4.13",
"@types/react-native-video": "5.0.14",
"@types/react-query": "1.2.9",
"@types/react-test-renderer": "18.0.0",
"@typescript-eslint/eslint-plugin": "5.33.0",
"@typescript-eslint/parser": "5.33.0",
"babel-jest": "26.6.3",
"babel-plugin-module-resolver": "4.1.0",
"eslint": "8.21.0",
"eslint-config-prettier": "8.5.0",
"eslint-import-resolver-babel-module": "5.3.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-react-native": "4.0.0",
"husky": "8.0.1",
"jest": "26.6.3",
"lint-staged": "13.0.1",
"lodash": "4.17.21",
"metro-react-native-babel-preset": "0.72.1",
"patch-package": "6.4.7",
"prettier": "2.7.1",
"react-test-renderer": "18.1.0",
"reactotron-react-native": "5.0.2",
"solidarity": "3.0.4",
"typescript": "4.7.4"
},

node version is 16.20.2

Activity

  1. added
    question
    on Aug 6, 2024
  2. JedShiMing commented on Aug 8, 2024

    @JedShiMing

    me too

  3. Onibenjo commented on Aug 9, 2024

    @Onibenjo

    I'm facing same issue

  4. mikey94 commented on Aug 10, 2024

    @mikey94

    @reactrahul1110 I also got this one. Then i removed "@react-native-community/cli-platform-android": "^14.0.0", from package json and did npm install again then i got build succeeded. Also don't forget to clean gradle.

    Btw- i don't know the exact reason behind this issue.

  5. RamezzE commented on Aug 10, 2024

    @RamezzE

    @reactrahul1110 I also got this one. Then i removed "@react-native-community/cli-platform-android": "^14.0.0", from package json and did npm install again then i got build succeeded. Also don't forget to clean gradle.

    Btw- i don't know the exact reason behind this issue.

    I've tried that but it didn't work. I'm having the same issue as well.

    I also had the same error which would tell me it was on line 401, but resolved that with path adjustment in settings.gradle, but cannot resolve this one that points to line 420 in native_modules.gradle

  6. GilTRipper commented on Aug 12, 2024

    @GilTRipper

    same issue when using pnpm

  7. JedShiMing commented on Aug 13, 2024

    @JedShiMing

    me too
    It was a cache issue, the project was contaminated. I created a RN project of the same version, ported the logic over, and it worked.

  8. vishnuvasita21 commented on Aug 18, 2024

    @vishnuvasita21

    facing same error

    tried changing versions, clearing all the cache and re-building and it still is not solved.

  9. Frankenstien97 commented on Aug 18, 2024

    @Frankenstien97

    I solved this by removing nvm and installing a node.tar.xz file and setting the path in ~/.profile. Also, a restart to your machine.
    Somehow it is not getting the node installed by nvm.
    it is working now.

  10. vishnuvasita21 commented on Aug 18, 2024

    @vishnuvasita21

    I solved my issue by changing the versions to the following

    • Node.js 18.20.4
    • npm 10.7
    • Java 17.0.11

    then, cleared the cache of npm and gradle, reinstalled the node module and run

    1- npx expo prebuild --platform android --clean
    2- ```
    cd android
    ./gradlew assembleDebug --stacktrace --info

  11. Namnp1521 commented on Aug 20, 2024

    @Namnp1521

    any update?

  12. ntv19398 commented on Aug 21, 2024

    @ntv19398

    downgrade version @react-native-community/cli to 13.6.9 helped me solve the problem. This error appeared when I removed yarn.lock and it updated @react-native-community/cli to 14.0.0 myself.

  13. monasserymcp commented on Aug 21, 2024

    @monasserymcp

    @ntv19398 thanks worked for me

  14. HoaiHuynh commented on Aug 26, 2024

    @HoaiHuynh

    In my case, I have another package that requires the latest react-native version, so I add react-native version into solutions in package.json

    "resolutions": {
        "react-native": "0.70.8",
        "react-native-reanimated": "3.3.0"
    }
    
  15. Sabaa-Abdennabi commented on Aug 28, 2024

    @Sabaa-Abdennabi

    @reactrahul1110 I also got this one. Then i removed "@react-native-community/cli-platform-android": "^14.0.0", from package json and did npm install again then i got build succeeded. Also don't forget to clean gradle.
    Btw- i don't know the exact reason behind this issue.

    I've tried that but it didn't work. I'm having the same issue as well.

    I also had the same error which would tell me it was on line 401, but resolved that with path adjustment in settings.gradle, but cannot resolve this one that points to line 420 in native_modules.gradle

    i am facing the same issue , how did you fix it ?

  16. mikey94 commented on Aug 28, 2024

    @mikey94

    @Sabaa-Abdennabi

    steps I followed -

    1). Remove node modules -> rm -rf node_modules/
    2). install modules -> npm install
    3). clean gradle -> cd android and ./gradlew clean

    Then i opened my react native android app using android studio and run build gradle. After that issue got fixed.

    my node version -v 20.13.1
    npm version - 10.5.2
    java version -

    openjdk 17.0.1 2021-10-19
    OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12)
    OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode)
    

    Also this is my package json

    `"dependencies": {
        "@fortawesome/fontawesome-svg-core": "^6.6.0",
        "@fortawesome/free-solid-svg-icons": "^6.6.0",
        "@fortawesome/react-native-fontawesome": "^0.3.2",
        "@react-native-async-storage/async-storage": "^1.24.0",
        "@react-navigation/bottom-tabs": "^6.6.1",
        "@react-navigation/drawer": "^6.7.2",
        "@react-navigation/native": "^6.1.18",
        "@react-navigation/native-stack": "^6.11.0",
        "@reduxjs/toolkit": "^2.2.7",
        "@types/jest": "^29.5.12",
        "axios": "^1.7.4",
        "react": "18.2.0",
        "react-native": "0.74.4",
        "react-native-dotenv": "^3.4.11",
        "react-native-gesture-handler": "^2.18.1",
        "react-native-reanimated": "^3.15.0",
        "react-native-safe-area-context": "^4.10.8",
        "react-native-screens": "^3.34.0",
        "react-native-svg": "^15.5.0",
        "react-native-vector-icons": "^10.1.0",
        "react-redux": "^9.1.2",
        "redux-persist": "^6.0.0",
        "redux-thunk": "^3.1.0"
      },
      "devDependencies": {
        "@babel/core": "^7.20.0",
        "@babel/preset-env": "^7.20.0",
        "@babel/runtime": "^7.20.0",
        "@react-native/babel-preset": "0.74.86",
        "@react-native/eslint-config": "0.74.86",
        "@react-native/metro-config": "0.74.86",
        "@react-native/typescript-config": "0.74.86",
        "@types/react": "^18.2.6",
        "@types/react-test-renderer": "^18.0.0",
        "babel-jest": "^29.6.3",
        "eslint": "^8.19.0",
        "jest": "^29.6.3",
        "prettier": "2.8.8",
        "react-test-renderer": "18.2.0",
        "typescript": "5.0.4"
      },
      "engines": {
        "node": ">=18"
      }`
    
  17. szymonrybczak commented on Aug 30, 2024

    @szymonrybczak
    Collaborator

    Hey all! To make all clear let me know provide you steps that are recommended and which are not:

    1. You shouldn't have @react-native-community/cli in your package.json, because it can lead to version mismatches and scenarios like this one where some flag is unavailable.
    2. When upgrading React Native version please ensure that you have all caches cleared.
    3. If you're upgrading to React Native 0.75 and you have an issue with --platform flag, you can try running it from root directory of the project:
    npx react-native config --platform android
    

    If it fails please check on which CLI version are you using by executing:

    npx react-native -v
    

    If you followed all steps and it's still failing please create a new issue with relevant informations and package.json. I hope that helps!

  18. sniperosx commented on Sep 26, 2024

    @sniperosx

    For me, it was the same problem after deleting/clearing the yarn.lock.
    Thereafter, the @react-native-community/cli had been upgraded implicitly and made issues in a legacy project (RN 0.70). I discarded the modified yarn.lock and looked up the prior version of @react-native-community/cli. For me, it was and way older version of 9.3.2. I put it temporarily as a dev dependency and look: Gradle build is running fine again 👍

    Not the long-term solution but at least usable for a hotfix release. Think upgrading to newer RN versions and pulling up Gradle as well should solve the problem as well.

  19. Yaya12085 commented on Oct 1, 2024

    @Yaya12085

    I had this problem when deleting my yarn.lock because I use pnpm but I created the
    .npmrc file at the root with
    node-linker=hoisted inside

  20. petragliamateo commented on Dec 12, 2024

    @petragliamateo

    I had this problem and I solved it by manually running the script:

    node C:{path_to_your_project}\node_modules@react-native-community\cli\build\bin.js config --platform android

    then shows the error, in my case I had to add package={package_name} in the AndroidManifest.xml of react-native-gesture-handler and react-native-maps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions