Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK 46 beta] Build error regarding d3-array #18319

Closed
jedahan opened this issue Jul 20, 2022 · 11 comments
Closed

[SDK 46 beta] Build error regarding d3-array #18319

jedahan opened this issue Jul 20, 2022 · 11 comments
Labels
needs validation Issue needs to be validated

Comments

@jedahan
Copy link
Contributor

jedahan commented Jul 20, 2022

Summary

When using eas build on SDK46, we get the following error in the Install pods section:

Installing pods

Using Expo modules

[stderr] error Failed to load configuration of your project.

[!] Invalid `Podfile` file: 783: unexpected token at 'Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/expo/workingdir/build/node_modules/d3-array/package.json

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

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

    at packageExportsResolve (node:internal/modules/esm/resolve:692: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/expo/workingdir/build/node_modules/@react-native-community/cli-tools/build/resolveNodeModuleDir.js:24:42)

    at /Users/expo/workingdir/build/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/expo/workingdir/build/ios/Podfile:14

 #  -------------------------------------------

 #    use_expo_modules!

 >    config = use_native_modules!

 #  

 #  -------------------------------------------

pod exited with non-zero code: 1

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

46 beta

Environment

  expo-env-info 1.0.4 environment info:
    System:
      OS: macOS 12.4
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.16.0 - /opt/homebrew/opt/node@16/bin/node
      npm: 8.11.0 - /opt/homebrew/opt/node@16/bin/npm
    Managers:
      CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    IDEs:
      Android Studio: 2021.1 AI-211.7628.21.2111.8193401
      Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
    npmPackages:
      babel-preset-expo: ~9.2.0 => 9.2.0 
      expo: next => 46.0.0-beta.6 
      react: 18.0.0 => 18.0.0 
      react-dom: 18.0.0 => 18.0.0 
      react-native: 0.69.1 => 0.69.1 
    npmGlobalPackages:
      eas-cli: 0.55.1
      expo-cli: 5.5.1
    Expo Workflow: managed

Reproducible demo

EXPO_BETA=1 npx create-expo-app
cd appdirectory
npm install --save d3-array

Add this somewhere in app.js

import { median } from 'd3-array'
const m = median(3, 6, 8)
console.log({m})

Try doing eas build --profile development

Tried making this snack https://snack.expo.dev/@jedahan/jealous-pretzels but it seems snack doesn't support SDK44, 45, or 46 beta.

@jedahan jedahan added the needs validation Issue needs to be validated label Jul 20, 2022
@brentvatne
Copy link
Member

brentvatne commented Jul 21, 2022

notice in the stacktrace that this is coming from @react-native-community/cli-tools/build/resolveNodeModuleDir which is used by @react-native-community/cli-config/build/loadConfig - here are the related issues on react-native community cli repo: react-native-community/cli#1168 react-native-community/cli#1650

this is the script that is run by react-native-community's autolinking implementation to determine which native modules exist. we can't fix this ourselves, it looks like it may need to be updated in d3-array. you may want to roll back to whichever version of d3-array you were using prior to the sdk 46 beta upgrade

@jedahan
Copy link
Contributor Author

jedahan commented Jul 22, 2022

The minimal reproducible example worked on SDK45. See https://expo.dev/accounts/jedahan/projects/testd3sdk45

@brentvatne
Copy link
Member

@jedahan - the react-native-community cli version changed between releases and likely that is what caused this

@maitriyogin
Copy link

Hiya,
I kind of get something similar with d3 when trying to build on sdk46:

Install Pods

error Failed to load configuration of your project.
[!] Invalid `Podfile` file: 783: unexpected token at 'Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/expo/workingdir/build/node_modules/d3/package.json
    at new NodeError (node:internal/errors:371:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:692: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/expo/workingdir/build/node_modules/@react-native-community/cli-tools/build/resolveNodeModuleDir.js:24:42)
    at /Users/expo/workingdir/build/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/expo/workingdir/build/em-app/ios/Podfile:14
 #  -------------------------------------------
 #    use_expo_modules!
 >    config = use_native_modules!
 #  
 #  -------------------------------------------

I'll try updating d3 ... ?

@jedahan
Copy link
Contributor Author

jedahan commented Jul 25, 2022

@maitriyogin every package now needs to export its own package.json here is an untested PR i made for d3-scale, as an example.

d3/d3-scale#265

@maitriyogin
Copy link

ok, in my case it's in the main D3 package, I just updated to d3@^7.6.1.
Although when looking in the package.json file, there's no export of

"./package.json": "./package.json"

patch package .. and then maybe a PR

@jedahan
Copy link
Contributor Author

jedahan commented Jul 26, 2022

mbostock will not support those PRs, they have been closed

@jedahan
Copy link
Contributor Author

jedahan commented Jul 26, 2022

@brentvatne it looks like the next version of react native 0.69.x will have this fix in facebook/react-native#34272 . Could you confirm when that gets released (likely 0.69.4), it will be part of SDK46?

@giacomoalonzi
Copy link

giacomoalonzi commented Sep 13, 2022

I've incurred in a similar issue, even on EAS cloud with SDK 46

Using Expo modules
Auto-generating `.xcode.env.local` with $NODE_BINARY=/Users/expo/.nvm/versions/node/v16.13.2/bin/node
[stderr] error Failed to load configuration of your project.
[!] Invalid `Podfile` file: 783: unexpected token at 'info Run CLI with --verbose flag for more details.
'.
 #  from /Users/expo/workingdir/build/ios/Podfile:14
 #  -------------------------------------------
 #    use_expo_modules!
 >    config = use_native_modules!
 #  
 #  -------------------------------------------
pod exited with non-zero code: 1

env-info

  expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 12.6
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
      Yarn: 1.22.19 - ~/.yarn/bin/yarn
      npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
      Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.11.3 - /Users/x/.rvm/gems/ruby-2.7.2/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    IDEs:
      Android Studio: 2021.1 AI-211.7628.21.2111.8092744
      Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~46.0.9 => 46.0.10 
      react: 18.0.0 => 18.0.0 
      react-dom: 18.0.0 => 18.0.0 
      react-native: 0.69.5 => 0.69.5 
      react-native-web: ~0.18.7 => 0.18.9 
    npmGlobalPackages:
      eas-cli: 2.1.0
      expo-cli: 6.0.0
    Expo Workflow: bare```

@jadonhansen
Copy link

jadonhansen commented Sep 18, 2022

Having the same issue. Error is not mentioning any 3rd party package though.

Expo SDK46
RN: 0.69.5
macOS, M2 chip

Output:

Using Expo modules
error Failed to load configuration of your project.

[!] Invalid `Podfile` file: 767: unexpected token at 'info Run CLI with --verbose flag for more details.
'.

 #  from /Users/jadonhansen/Documents/Personal_Work/DigiWallet/ios/Podfile:14
 #  -------------------------------------------
 #    use_expo_modules!
 >    config = use_native_modules!
 #
 #  -------------------------------------------

EDIT: Downgraded to Expo SDK45 is working for me. Unfortunately having the latest of everything isn't aways the best :/

@manuelmhtr
Copy link

Check this solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs validation Issue needs to be validated
Projects
None yet
Development

No branches or pull requests

6 participants