cli: Gradle exception: Failed to parse React Native CLI configuration

Environment

System: OS: Windows 10 CPU: (4) x64 Intel® Core™ i5-3570 CPU @ 3.40GHz Memory: 1.47 GB / 7.96 GB Binaries: Node: 12.8.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.19.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.10.2 - C:\Program Files\nodejs\npm.CMD SDKs: Android SDK: API Levels: 25, 27, 28, 29 Build Tools: 25.0.3, 28.0.3, 29.0.2 System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.4 => 0.61.4

Description

Simply trying to run the react-native run-android command returns me this React Native CLI-related error.

` info Running jetifier to migrate libraries to AndroidX. You can disable it using “–no-jetifier” flag. Jetifier found 1032 file(s) to forward-jetify. Using 4 workers… info Starting JS server… info Installing the app… :ReactNative:Failed to parse React Native CLI configuration: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is ‘E’ with an int value of 69 Unable to determine the current character, it is not a string, number, array, or object line number 1 index number 0 Error: EPERM: operation not permitted, scandir ‘C:/Users/Master/Desktop/proj/UltimaTentativa/android/app/build/intermediates/signing_config/debug/out/signing-config.json’ at Object.readdirSync (fs.js:795:3) at GlobSync._readdir (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:288:41) at GlobSync._readdirInGlobStar (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:267:20) at GlobSync._readdir (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:276:17) at GlobSync._processReaddir (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:137:22) at GlobSync._process (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:132:10) at GlobSync._processGlobStar (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:380:10) at GlobSync._process (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:130:10) at GlobSync._processGlobStar (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:383:10) at GlobSync._process (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:130:10) ^

FAILURE: Build failed with an exception.

  • Where: Script ‘C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules@react-native-community\cli-platform-android\native_modules.gradle’ line: 200

  • What went wrong: A problem occurred evaluating script.

Failed to parse React Native CLI configuration. Expected running ‘npx.cmd --quiet --no-install react-native config’ command from ‘C:\Users\Master\Desktop\proj\UltimaTentativa’ directory to output valid JSON, but it didn’t. This may be caused by npx resolving to a legacy global react-native binary. Please make sure to uninstall any global ‘react-native’ binaries: ‘npm uninstall -g react-native react-native-cli’ and try again

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 :ReactNative:Failed to parse React Native CLI configuration: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is ‘E’ with an int value of 69 Unable to determine the current character, it is not a string, number, array, or object line number 1 index number 0 Error: EPERM: operation not permitted, scandir ‘C:/Users/Master/Desktop/proj/UltimaTentativa/android/app/build/intermediates/signing_config/debug/out/signing-config.json’ at Object.readdirSync (fs.js:795:3) at GlobSync._readdir (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:288:41) at GlobSync._readdirInGlobStar (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:267:20) at GlobSync._readdir (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:276:17) at GlobSync._processReaddir (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:137:22) at GlobSync._process (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:132:10) at GlobSync._processGlobStar (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:380:10) at GlobSync._process (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:130:10) at GlobSync._processGlobStar (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:383:10) at GlobSync._process (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\glob\sync.js:130:10) ^

FAILURE: Build failed with an exception.

  • Where: Script ‘C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules@react-native-community\cli-platform-android\native_modules.gradle’ line: 200

  • What went wrong: A problem occurred evaluating script.

Failed to parse React Native CLI configuration. Expected running ‘npx.cmd --quiet --no-install react-native config’ command from ‘C:\Users\Master\Desktop\proj\UltimaTentativa’ directory to output valid JSON, but it didn’t. This may be caused by npx resolving to a legacy global react-native binary. Please make sure to uninstall any global ‘react-native’ binaries: ‘npm uninstall -g react-native react-native-cli’ and try again

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s

at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Command.handleAction (C:\Users\Master\Desktop\proj\UltimaTentativa\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:9)

`

Reproducible Demo

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (7 by maintainers)

Most upvoted comments

Just removed the build folder inside android and go to android folder and then in powershell typed ./gradlew clean and then cd… => npx react-native run-android

delete the files it was finding error as “The current character read is ‘E’ with an int value of 69” Deleting app\build\intermediates\signing_config\debug\out\signing-config.json worked for me.

I solved by checking AndroidManifest.xml and solving the errors there. Basically there has the error in my case. and also deleted node_modules and run

yarn install

@fabiocosta88, can you run

npx.cmd --quiet --no-install react-native config’

from C:\Users\Master\Desktop\proj\UltimaTentativa

and paste the output?

I wonder why Gradle says the JSON is invalid. Something must be wrong here and we need to get a reproduction to fix it for you and others!

Thanks for your collaboration