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

Failed to load configuration of your project('./package.json' is not defined by "exports") #73

Closed
rpopovici opened this issue Jul 12, 2022 · 3 comments

Comments

@rpopovici
Copy link

rpopovici commented Jul 12, 2022

I am getting this error with the latest version or react-native 0.69

[react-native] error Failed to load configuration of your project.
[react-native] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in ../node_modules/fetch-cookie/package.json
[react-native]     at throwExportsNotFound (internal/modules/esm/resolve.js:299:9)
[react-native]     at packageExportsResolve (internal/modules/esm/resolve.js:522:3)
[react-native]     at resolveExports (internal/modules/cjs/loader.js:449:36)
[react-native]     at Function.Module._findPath (internal/modules/cjs/loader.js:489:31)
[react-native]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:875:27)
[react-native]     at Function.resolve (internal/modules/cjs/helpers.js:98:19)
[react-native]     at resolveNodeModuleDir (../node_modules/@react-native-community/cli-tools/build/resolveNodeModuleDir.js:24:42)
[react-native]     at ../node_modules/@react-native-community/cli-config/build/loadConfig.js:93:76
[react-native]     at Array.reduce (<anonymous>)
[react-native]     at loadConfig (../node_modules/@react-native-community/cli-config/build/loadConfig.js:91:134)
[react-native] info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
@rpopovici
Copy link
Author

rpopovici commented Jul 12, 2022

Doing this in fetch-cookie/package.json apparently fixes the problem:

  "exports": {
    "./package.json": "./package.json",
    ".": {
      "import": {
        "types": "./esm/index.d.ts",
        "default": "./esm/index.js"
      },
      "require": {
        "types": "./cjs/index.d.ts",
        "default": "./cjs/index-wrapper.js"
      }
    }
  },

Stole it from here uuidjs/uuid#449

@rpopovici rpopovici changed the title Failed to load configuration of your project Failed to load configuration of your project('./package.json' is not defined by "exports") Jul 12, 2022
@valeriangalliat
Copy link
Owner

Thanks for reporting and finding the fix! Published with 2.1.0, let me know if it works for you =)

@rpopovici
Copy link
Author

@valeriangalliat looks like it's working. Thanks!

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

No branches or pull requests

2 participants