expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
814 stars 83 forks source link

Error: Cannot find module 'react-native-svg-transformer/expo' #2657

Closed FaisalST32 closed 4 hours ago

FaisalST32 commented 4 hours ago

Build/Submit details page URL

No response

Summary

I have been facing an issue with npx eas build --platform android --local for the past 2 days. Below is the output.

[RUN_GRADLEW] Error: Cannot find module 'react-native-svg-transformer/expo'
[RUN_GRADLEW] Require stack:
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/metro.config.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/node_modules/import-fresh/index.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/dist/loaders.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/dist/createExplorer.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/dist/index.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/metro-config/src/loadConfig.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/metro-config/src/index.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/src/start/server/metro/instantiateMetro.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/src/export/embed/exportEmbedAsync.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/src/export/embed/index.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/bin/cli
[RUN_GRADLEW] Error: Cannot find module 'react-native-svg-transformer/expo'
[RUN_GRADLEW] Require stack:
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/metro.config.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/node_modules/import-fresh/index.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/dist/loaders.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/dist/createExplorer.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/dist/index.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/metro-config/src/loadConfig.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/metro-config/src/index.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/src/start/server/metro/instantiateMetro.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/src/export/embed/exportEmbedAsync.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/src/export/embed/index.js
[RUN_GRADLEW] - /private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/@expo/cli/build/bin/cli
[RUN_GRADLEW]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
[RUN_GRADLEW]     at Function.resolve (node:internal/modules/helpers:187:19)
[RUN_GRADLEW]     at Object.<anonymous> (/private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/metro.config.js:2:22)
[RUN_GRADLEW]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[RUN_GRADLEW]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[RUN_GRADLEW]     at Module.load (node:internal/modules/cjs/loader:1207:32)
[RUN_GRADLEW]     at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
[RUN_GRADLEW]     at Module.require (node:internal/modules/cjs/loader:1235:19)
[RUN_GRADLEW]     at require (node:internal/modules/helpers:176:18)
[RUN_GRADLEW]     at module.exports (/private/var/folders/70/xsvn9hb50tx5ybbjl2q_qb2h0000gp/T/eas-build-local-nodejs/2a9cef2a-550c-466c-afab-1a64315882b0/build/node_modules/cosmiconfig/node_modules/import-fresh/index.js:28:9)
[RUN_GRADLEW] FAILURE: Build failed with an exception.
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] Execution failed for task ':app:createBundleReleaseJsAndAssets'.
[RUN_GRADLEW] > Process 'command 'node'' finished with non-zero exit value 1
[RUN_GRADLEW] * Try:
[RUN_GRADLEW] > Run with --stacktrace option to get the stack trace.
[RUN_GRADLEW] > Run with --info or --debug option to get more log output.
[RUN_GRADLEW] > Run with --scan to get full insights.
[RUN_GRADLEW] > Get more help at https://help.gradle.org.
[RUN_GRADLEW] BUILD FAILED in 28s
[RUN_GRADLEW] Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
[RUN_GRADLEW] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[RUN_GRADLEW] For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
[RUN_GRADLEW] 21 actionable tasks: 21 executed
[RUN_GRADLEW] Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Build failed
Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
npx exited with non-zero code: 1

Here's my metro.config.js

const { getDefaultConfig } = require('expo/metro-config');

module.exports = (() => {
    const config = getDefaultConfig(__dirname);

    const { transformer, resolver } = config;

    config.transformer = {
        ...transformer,
        babelTransformerPath: require.resolve(
            'react-native-svg-transformer/expo'
        ),
    };
    config.resolver = {
        ...resolver,
        assetExts: resolver.assetExts.filter((ext) => ext !== 'svg'),
        sourceExts: [...resolver.sourceExts, 'svg'],
    };

    return config;
})();

The package is installed. I have confirmed that.

Need help.

Managed or bare?

Managed

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 15.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.11.1 - /usr/local/bin/node
      Yarn: 1.22.22 - /usr/local/bin/yarn
      npm: 10.2.4 - /usr/local/bin/npm
    Managers:
      CocoaPods: 1.15.2 - /Users/xxxx/.rvm/rubies/ruby-3.2.1/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 24.0, iOS 18.0, macOS 15.0, tvOS 18.0, visionOS 2.0, watchOS 11.0
    IDEs:
      Android Studio: 2023.2 AI-232.10227.8.2321.11479570
      Xcode: 16.0/16A242d - /usr/bin/xcodebuild
    npmPackages:
      expo: ~51.0.37 => 51.0.37 
      expo-router: ~3.5.23 => 3.5.23 
      react: 18.2.0 => 18.2.0 
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.74.5 => 0.74.5 
      react-native-web: ~0.19.10 => 0.19.12 
    npmGlobalPackages:
      eas-cli: 12.6.0
    Expo Workflow: managed
✔ Check Expo config for common issues
✖ Check package.json for common issues
✔ Check if the project meets version requirements for submission to app stores
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for issues with Metro config
✔ Check npm/ yarn versions
✖ Check for app config fields that may not be synced in a non-CNG project
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check native tooling versions
✖ Check that packages match versions required by installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✖ Check that native modules use compatible support package versions for installed Expo SDK

Detailed check results:

Expected package @expo/config-plugins@~8.0.0
Found invalid:
  @expo/config-plugins@7.8.4
  @expo/config-plugins@7.3.1
  @expo/config-plugins@7.8.4
  @expo/config-plugins@7.9.2
  (for more info, run: npm why @expo/config-plugins)
Expected package @expo/prebuild-config@~7.0.0
Found invalid:
  @expo/prebuild-config@6.7.3
  (for more info, run: npm why @expo/prebuild-config)
Advice: Upgrade dependencies that are using the invalid package versions.

The following scripts in package.json conflict with the contents of node_modules/.bin: eas.

This project contains native project folders but also has native configuration properties in app.json, indicating it is configured to use Prebuild. When the android/ios folders are present, EAS Build will not sync the following properties: orientation, icon, scheme, userInterfaceStyle, splash, ios, android, plugins. 

Advice: Add '/android' and '/ios' to your .gitignore file if you intend to use CNG / Prebuild. Learn more: https://docs.expo.dev/workflow/prebuild/#usage-with-eas-build

Warning: Root-level "expo" object found. Ignoring extra key in Expo config: "build"
Learn more: https://expo.fyi/root-expo-object
The following packages should be updated for best compatibility with the installed expo version:
  expo@51.0.37 - expected version: ~51.0.38
Your project may not work correctly until you install the expected versions of the packages.
Found outdated dependencies
Advice: Use 'npx expo install --check' to review and upgrade your dependencies.

Error output

No response

Reproducible demo or steps to reproduce from a blank project

The issue occurs by simply running the build command.

FaisalST32 commented 4 hours ago

I was able to resolve it by removing the said package and then adding it back again as a normal dependency rather than a devDependency. Not sure how that works.