开发者问题收集

[node, @react-native-community\cli\build\bin.js, config]` 完成并出现异常。错误消息:groovy.json.JsonException

2023-07-04
4956

描述 之前我想继续完成我的 React Native Android 应用程序,但运行后,出现了从未发生过的错误:

错误详细信息 失败:构建失败,出现异常。

  • 其中: 脚本“D:\KonselingTelyu\node_modules@react-native-community\cli-platform-android\native_modules.gradle”行:450

  • 出了什么问题: 评估脚本时出现问题。

Calling [node, D:\KonselingTelyu\node_modules\@react-native-community\cli\build\bin.js, config] finished with an exception. Error message: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

当前读取的字符是“i”,int 值为 105 无法确定当前字符,它不是字符串、数字、数组或对象 行号 1 索引号 0 信息使用 --verbose 标志运行 CLI 以获取更多详细信息。 ^。输出:info 使用 --verbose 标志运行 CLI 以获取更多详细信息。

  • 尝试:

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.

3 分 24 秒内构建失败

错误 无法安装应用程序。请确保您已设置 Android 开发环境: https://reactnative.dev/docs/environment-setup 。 错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

失败:构建失败,出现异常。

  • 其中: 脚本“D:\KonselingTelyu\node_modules@react-native-community\cli-platform-android\native_modules.gradle”行:450

  • 出错原因: 评估脚本时出现问题。

Calling [node, D:\KonselingTelyu\node_modules\@react-native-community\cli\build\bin.js, config] finished with an exception. Error message: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

当前读取的字符为“i”,int 值为 105 无法确定当前字符,它不是字符串、数字、数组或对象 行号 1 索引号 0 信息使用 --verbose 标志运行 CLI 以获取更多详细信息。 ^.输出:info 使用 --verbose 标志运行 CLI 以获取更多详细信息。

  • 尝试:

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.

3 分 24 秒内构建失败

at makeError (D:\KonselingTelyu\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at D:\KonselingTelyu\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (D:\KonselingTelyu\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\KonselingTelyu\node_modules\@react-native-community\cli\build\index.js:142:9)

info 使用 --verbose 标志运行 CLI 以获取更多详细信息。

  • react-native info

D:\KonselingTelyu>react-native info info Fetching system and libraries information... (node:4328) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use node --trace-warnings ... to show where the warning was created) System: OS: Windows 10 10.0.19045 CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz Memory: 6.69 GB / 11.90 GB Binaries: Node: 18.12.1 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 9.7.2 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels: 28, 30, 31, 33 Build Tools: 28.0.3, 30.0.2, 30.0.3, 31.0.0 System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom Android NDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Version 2020.3.0.0 AI-203.7717.56.2031.7678000 Visual Studio: Not Found Languages: Java: 11.0.17 npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.6 => 0.70.6 react-native-windows: Not Found npmGlobalPackages: react-native : Not Found

  • npm 列表@react-native-community/cli

[email protected] D:\KonselingTelyu -- [email protected] -- @react-native-community/ [email protected]

  • package.json

{ "name": "KonselingTelyu", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@firebase/firestore": "^3.12.0", "@react-native-async-storage/async-storage": "^1.17.11", "@react-native-firebase/app": "^17.5.0", "@react-native-firebase/firestore": "^17.5.0", "@react-navigation/bottom-tabs": "^6.5.2", "@react-navigation/native": "^6.1.1", "@react-navigation/stack": "^6.3.10", "@reduxjs/toolkit": "^1.9.5", "firebase": "^9.16.0", "react": "18.1.0", "react-native": "0.70.6", "react-native-flash-message": "^0.4.0", "react-native-fs": "^2.20.0", "react-native-gesture-handler": "^2.8.0", "react-native-image-picker": "^5.0.1", "react-native-restart": "^0.0.24", "react-native-safe-area-context": "^4.4.1", "react-native-screens": "^3.18.2", "react-native-svg": "^13.6.0", "react-native-svg-transformer": "^1.0.0", "react-native-update-cli": "^1.11.0", "react-native-version-check": "^3.4.7", "react-redux": "^8.1.1", "xlsx": "^0.18.5" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", "eslint": "^7.32.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "0.72.3", "react-test-renderer": "18.1.0" }, "jest": { "preset": "react-native" } }

2个回答

我也遇到了这种情况,为了节省时间,我执行了以下命令:

rm -rf ./android/app/release

我使用Android Studio生成APK,因此提到的目录是 /android/app/release

xiaobo
2023-07-11

几天来我都遇到同样的问题,但我能够通过使用 yarn install expo@^48.0.0 升级我的 expo 项目并使用 npx expo install --fix 修复所有依赖项以匹配 SDK 48 来解决它。

我希望这对某些人有帮助。

Otis-iDev
2023-08-14