Skip to content

Error: Cannot resolve ./override #143

@quicksilverr

Description

@quicksilverr

Describe the bug

Hey, after importing config from react-native-ultimate-config, I'm getting this error

error: Error: Cannot resolve ./override
    at /project/node_modules/@nx/react-native/plugins/metro-resolver.js:31:15
    at Object.resolve (/ project/node_modules/metro-resolver/src/resolve.js:47:12)
    at ModuleResolver.resolveDependency (/ project/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:79:31)
    at DependencyGraph.resolveDependency ( /project/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
    at Object.resolve ( /project/node_modules/metro/src/lib/transformHelpers.js:169:21)
    at Graph._resolveDependencies ( /project/node_modules/metro/src/DeltaBundler/Graph.js:473:35)
    at Graph._processModule ( /project/node_modules/metro/src/DeltaBundler/Graph.js:261:38)
    at async Graph._addDependency ( /project/node_modules/metro/src/DeltaBundler/Graph.js:372:20)
    at async Promise.all (index 7)
    at async Graph._processModule (/ project/node_modules/metro/src/DeltaBundler/Graph.js:322:5)

Steps to Reproduce

  • Just install the package in a react native project, and import config from the package.
  • Getting the metro resolver error.

Steps to reproduce the behavior.

Please consider creating small project that demonstrates the problem.
Having done clean setup helps pinpointing the problem.

Expected behavior

This snippet should work

// import module
import config from "react-native-ultimate-config";

// access variables
config.MY_CONFIG;

Stacktraces, logs, screenshots

Post stacktraces, logs or screenshots. The more information is available
is better.

Environment

Integration option

  • I am using rnuc CLI to inject environment (default integration option
    from quickstart guide)
  • I am using scheme/flavor based integration (experimental integration
    option from cookbook:
    scheme,
    flavors)
  • I am using react-native-ultimate-config within monorepo managed with NX Monorepo

Env file

  • I am using dotenv file as a source for variables
  • I am using YAML file as a source for variables

Example of env file that is causing problems

❗PROVIDE EXAMPLE OF ENV FILE

OS

  • ios
  • android

Packages

  • version of react-native: ❗0.72.3
  • version of react-native-ultimate-config: ❗6.0.1

Run react-native info and post below:

System:
  OS: macOS 13.3
  CPU: (8) arm64 Apple M1
  Memory: 62.13 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 19.5.0
    path: /var/folders/w1/6fkl87mj5n9cmc_nk6xfsz7h0000gn/T/yarn--1704361025739-0.5088639990007069/node
  Yarn:
    version: 1.22.19
    path: /var/folders/w1/6fkl87mj5n9cmc_nk6xfsz7h0000gn/T/yarn--1704361025739-0.5088639990007069/yarn
  npm:
    version: 9.3.1
    path: ~/.nvm/versions/node/v19.5.0/bin/npm
  Watchman:
    version: 2023.05.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.11.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK:
    API Levels:
      - "23"
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 34.0.0
    System Images:
      - android-31 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2020.3 AI-203.7717.56.2031.7678000
  Xcode:
    version: 14.3/14E222b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 1.8.0_292
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: "*"
  react-native:
    installed: 0.72.3
    wanted: "*"
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions