在 monorepo 中构建 EAS 失败(无法构造转换器:错误:无法解析)任务 ':app:bundleReleaseJsAndAssets' 执行失败

问题描述 投票:0回答:2

使用

create-solito-app
创建了一个新的入门模板,然后尝试使用eas build构建项目,但构建失败,日志已附加。 我正在尝试这种使用共享代码创建 NextJs 和 Expo 应用程序的新方法,但我无法构建该项目。
我已运行以下命令。

➜  npx create-solito-app@latest my-solito-app
➜  cd apps/expo 
➜  expo eas build --platform android

以下是来自eas构建的日志

Running 'gradlew :app:bundleRelease' in /home/expo/workingdir/build/android
Downloading https://services.gradle.org/distributions/gradle-6.9-all.zip
Unzipping /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9-all.zip to /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs
Set executable permissions for: /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9/bin/gradle
Welcome to Gradle 6.9!
Here are the highlights of this release:
 - This is a small backport release.
 - Java 16 can be used to compile when used with Java toolchains
 - Dynamic versions can be used within plugin declarations
 - Native support for Apple Silicon processors
For more details see https://docs.gradle.org/6.9/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.9/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
> Configure project :expo-file-system
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
> Configure project :expo
Using expo modules
  - expo-application (4.0.2)
  - expo-constants (13.0.2)
  - expo-error-recovery (3.0.5)
  - expo-file-system (13.1.4)
  - expo-font (10.0.5)
  - expo-keep-awake (10.0.2)
- expo-modules-core (0.6.5)
  - expo-splash-screen (0.14.2)
  - react-native-reanimated (2.3.3)
[stderr] Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
[stderr] Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
[stderr] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
[stderr] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
[stderr] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
[stderr] Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
[stderr] Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
[stderr] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
[stderr] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
[stderr] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Welcome to Metro!
              Fast - Scalable - Integrated
[stderr] Failed to construct transformer:  Error: Cannot parse /home/expo/.nvm/test/fast/Unit tests/mocks/project_dirs/nested-both/package.json as JSON: Unexpected end of JSON input
[stderr]     at Object.worker (/home/expo/workingdir/build/node_modules/jest-haste-map/build/worker.js:146:13)
[stderr]     at HasteMap._processFile (/home/expo/workingdir/build/node_modules/jest-haste-map/build/index.js:724:8)
[stderr]     at HasteMap._buildHasteMap (/home/expo/workingdir/build/node_modules/jest-haste-map/build/index.js:776:28)
[stderr]     at /home/expo/workingdir/build/node_modules/jest-haste-map/build/index.js:426:33
[stderr] error Cannot parse /home/expo/.nvm/test/fast/Unit tests/mocks/project_dirs/nested-both/package.json as JSON: Unexpected end of JSON input.
Error: Cannot parse /home/expo/.nvm/test/fast/Unit tests/mocks/project_dirs/nested-both/package.json as JSON: Unexpected end of JSON input
    at Object.worker (/home/expo/workingdir/build/node_modules/jest-haste-map/build/worker.js:146:13)
    at HasteMap._processFile (/home/expo/workingdir/build/node_modules/jest-haste-map/build/index.js:724:8)
    at HasteMap._buildHasteMap (/home/expo/workingdir/build/node_modules/jest-haste-map/build/index.js:776:28)
    at /home/expo/workingdir/build/node_modules/jest-haste-map/build/index.js:426:33
info Run CLI with --verbose flag for more details.
> Task :app:bundleReleaseJsAndAssets FAILED
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets'.
[stderr] > Process 'command 'node'' finished with non-zero exit value 1
[stderr] * Try:
[stderr] 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.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 2m 1s
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.9/userguide/command_line_interface.html#sec:command_line_warnings
1 actionable task: 1 executed
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.
build expo monorepo eas
2个回答
0
投票
Failed to construct transformer:  Error: Cannot parse /home/expo/.nvm/test/fast/Unit tests/mocks/project_dirs/nested-both/package.json as JSON: Unexpected end of JSON input

您的项目中似乎存在无效的

package.json
。您应该检查该文件并验证它是否正确。


0
投票

对我来说,将developmentClient 添加到eas.build 修复了它。但我不知道如果没有的话该怎么做。也许有些库需要玩笑测试,这就是原因......

© www.soinside.com 2019 - 2024. All rights reserved.