gradle 执行任务“:app:bundleReleaseJsAndAssets”失败

8ehkhllq  于 2022-11-14  发布在  其他
关注(0)|答案(1)|浏览(379)

我正在尝试使用React-native生成我的应用的发布版本。我运行了./gradlew assembleRelease,它给了我此错误:

AwesomeProject\android> ./gradlew assembleRelease

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
                 Welcome to React Native!
                Learn once, write anywhere

Failed to construct transformer:  Error: EPERM: operation not permitted, read
    at Object.readSync (fs.js:581:3)
    at tryReadSync (fs.js:357:20)
    at Object.readFileSync (fs.js:386:19)
    at Object.<anonymous> (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:220:39)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:78:24)
    at _next (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:98:9)
    at C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:103:7
    at new Promise (<anonymous>)
    at Object.<anonymous> (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:95:12) {
  type: 'Error',
  errno: -4048,
  syscall: 'read',
  code: 'EPERM'
}
error EPERM: operation not permitted, read. Run CLI with --verbose flag for more details.
Error: EPERM: operation not permitted, read
    at Object.readSync (fs.js:581:3)
    at tryReadSync (fs.js:357:20)
    at Object.readFileSync (fs.js:386:19)
    at Object.<anonymous> (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:220:39)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:78:24)
    at _next (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:98:9)
    at C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:103:7
    at new Promise (<anonymous>)
    at Object.<anonymous> (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\jest-haste-map\build\worker.js:95:12)

> Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 36s
56 actionable tasks: 2 executed, 54 up-to-date
PS C:\Users\Hamza Ahzam\Desktop\AwesomeProject\android> react-native bundle ...
Command `bundle` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.
PS C:\Users\Hamza Ahzam\Desktop\AwesomeProject\android> cd ..
PS C:\Users\Hamza Ahzam\Desktop\AwesomeProject> react-native bundle ...
error Option "--entry-file" is missing. Run CLI with --verbose flag for more details.
Error: Option "--entry-file" is missing
    at C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\assertRequiredOptions.js:51:13
    at Array.forEach (<anonymous>)
    at assertRequiredOptions (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\assertRequiredOptions.js:40:11)
    at Command.handleAction (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:181:42)
    at Command.listener (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:314:20)
    at Command.parseArgs (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\commander\index.js:651:12)
    at Command.parse (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\commander\index.js:474:21)
    at setupAndRun (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:267:24)
    at Object.run (C:\Users\Hamza Ahzam\Desktop\AwesomeProject\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:206:11

在观看了许多解决方案后,我尝试通过此命令构建APK。/gradlew assembleRelease -x bundleReleaseJsAndAssets构建APK是成功的,但当我在设备中运行它时,它崩溃了

8yoxcaq7

8yoxcaq71#

对于APK构建,您可以使用此命令-./gradlew assembleRelease -x捆绑包发布活动和资产;对于捆绑包发布,您可以使用--./gradlew捆绑包发布-x捆绑包发布活动和资产

相关问题