question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pod install & react-native info fail with @react-native-community/cli-config 8.0.3 and ramda 0.28.0 installed

See original GitHub issue

Environment

mihai@Mihais-Mac-mini PackageJsonErrorRepro % npx react-native info             
error Failed to load configuration of your project.
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/mihai/Desktop/Repos/PackageJsonErrorRepro/node_modules/ramda/package.json
    at new NodeError (node:internal/errors:370:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:335:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:560:3)
    at resolveExports (node:internal/modules/cjs/loader:476:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:516:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:913:27)
    at Function.resolve (node:internal/modules/cjs/helpers:99:19)
    at resolveNodeModuleDir (/Users/mihai/Desktop/Repos/PackageJsonErrorRepro/node_modules/@react-native-community/cli-tools/build/resolveNodeModuleDir.js:24:42)
    at /Users/mihai/Desktop/Repos/PackageJsonErrorRepro/node_modules/@react-native-community/cli-config/build/loadConfig.js:93:76
    at Array.reduce (<anonymous>)
info Run CLI with --verbose flag for more details.

If I remove ramda:

mihai@Mihais-Mac-mini PackageJsonErrorRepro % npx react-native info             
info Fetching system and libraries information...
System:
    OS: macOS 12.4
    CPU: (8) x64 Apple M1
    Memory: 393.95 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.5.0 - ~/.nvm/versions/node/v16.5.0/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v16.5.0/bin/yarn
    npm: 7.19.1 - ~/.nvm/versions/node/v16.5.0/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 26, 29, 30, 31
      Build Tools: 26.0.0, 29.0.2, 30.0.2, 30.0.3, 31.0.0
      System Images: android-24 | ARM 64 v8a, android-25 | Google APIs ARM 64 v8a, android-30 | Google APIs ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-31 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8139111
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.15 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0 
    react-native: 0.69.1 => 0.69.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Description

pod install throws an error with "@react-native-community/cli-config": "8.0.3" and "ramda": "0.28.0" installed. I am not sure if this is something that should be fixed in ramda (is it required to add "./package.json" to "exports" in package.json for all npm packages that use exports?) or in this project. The error does not happen with "@react-native-community/cli-config": "8.0.2".

The error for npx react-native info can be seen above, at the beginning of this description. The error for pod install:

mihai@Mihais-Mac-mini PackageJsonErrorRepro % yarn install && cd ios && pod install
yarn install v1.22.18
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "react-native > react-shallow-renderer@16.14.1" has incorrect peer dependency "react@^16.0.0 || ^17.0.0".
warning "react-native > react-native-codegen > jscodeshift@0.13.1" has unmet peer dependency "@babel/preset-env@^7.1.6".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] 🔨  Building fresh packages...

✨  Done in 3.83s.
error Failed to load configuration of your project.

[!] Invalid `Podfile` file: 859: unexpected token at 'Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/mihai/Desktop/Repos/PackageJsonErrorRepro/node_modules/ramda/package.json

    at new NodeError (node:internal/errors:370:5)

    at throwExportsNotFound (node:internal/modules/esm/resolve:335:9)

    at packageExportsResolve (node:internal/modules/esm/resolve:560:3)

    at resolveExports (node:internal/modules/cjs/loader:476:36)

    at Function.Module._findPath (node:internal/modules/cjs/loader:516:31)

    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:913:27)

    at Function.resolve (node:internal/modules/cjs/helpers:99:19)

    at resolveNodeModuleDir (/Users/mihai/Desktop/Repos/PackageJsonErrorRepro/node_modules/@react-native-community/cli-tools/build/resolveNodeModuleDir.js:24:42)

    at /Users/mihai/Desktop/Repos/PackageJsonErrorRepro/node_modules/@react-native-community/cli-config/build/loadConfig.js:93:76

    at Array.reduce (<anonymous>)

info Run CLI with --verbose flag for more details.
'.

 #  from /Users/mihai/Desktop/Repos/PackageJsonErrorRepro/ios/Podfile:8
 #  -------------------------------------------
 #  target 'PackageJsonErrorRepro' do
 >    config = use_native_modules!
 #  
 #  -------------------------------------------

Reproducible Demo

New React Native 0.69.1 project with ramda 0.28.0 installed: https://github.com/mlazari/PackageJsonErrorRepro/tree/main To reproduce run yarn install && cd ios && pod install, or even npx react-native info.

If I force "@react-native-community/cli-config": "8.0.2" via yarn “resolutions”, then pod install runs fine and npx react-native info just shows a warning for ramda (warn Package ramda has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/mihai/Desktop/Repos/PackageJsonErrorRepro/node_modules/ramda/package.json): https://github.com/mlazari/PackageJsonErrorRepro/tree/cli-config-8.0.2

For project using npm rather than yarn, the version can be forced to 8.0.2 via the “overrides” option:

  "overrides": {
    "@react-native-community/cli-config": "8.0.2"
  }

But there is a known issue with that: https://github.com/npm/cli/issues/4232

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:6
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
matinzdcommented, Jul 22, 2022

same issue with fast-check and lint-staged. Most third parties are broken.

[!] Invalid `Podfile` file: 859: unexpected token at 'Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/matin/w/dietdoctor/rnapp/node_modules/lint-staged/package.json

    at new NodeError (node:internal/errors:372:5)

    at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)

    at packageExportsResolve (node:internal/modules/esm/resolve:753:3)

    at resolveExports (node:internal/modules/cjs/loader:482:36)

    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)

    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)

    at Function.resolve (node:internal/modules/cjs/helpers:108:19)

    at resolveNodeModuleDir (/Users/matin/w/dietdoctor/rnapp/node_modules/@react-native-community/cli-tools/build/resolveNodeModuleDir.js:24:42)

    at /Users/matin/w/dietdoctor/rnapp/node_modules/@react-native-community/cli-config/build/loadConfig.js:93:76

    at Array.reduce (<anonymous>)
3reactions
alimekcommented, Jul 22, 2022

same issues is with d3-array package :

Invalid `Podfile` file: 859: unexpected token at 'Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in XXX/node_modules/d3-array/package.json
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix “pod install” error in React Native on Mac M1
You should then see a message in the terminal that, after analyzing and installing several dependencies, should tell you that the Pods project...
Read more >
pod install failed on macOS Big sur - react native
Locate Terminal.app in Finder · Right-click and choose Get Info · Check the Open using Rosetta · Quit Terminal app and run it...
Read more >
React-Native-Community Cli Statistics & Issues - Codesti
pod install & react-native info fail with @react-native-community/cli-config 8.0.3 and ramda 0.28.0 installed, closed, 8, 2022-07-14, 2022-11-16, 2022-07-26.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found