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

Bun@1.0.23+ install violates peer dependency constraints #8406

Closed
byCedric opened this issue Jan 23, 2024 · 7 comments · Fixed by yobgob/too-many-hooks#105
Closed

Bun@1.0.23+ install violates peer dependency constraints #8406

byCedric opened this issue Jan 23, 2024 · 7 comments · Fixed by yobgob/too-many-hooks#105
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@byCedric
Copy link

byCedric commented Jan 23, 2024

What version of Bun is running?

1.0.23+83f2432da

What platform is your computer?

Darwin 23.2.0 arm64 arm

What steps can reproduce the bug?

Starting from bun@1.0.23, bun install fails to install correct peer dependencies for at least 1 scenario.

Steps to repro

  • $ git clone git@github.com:bycedric/expo-template.git ./test && cd ./test
  • $ bun install
  • $ bun expo start or $ bun expo export --platform web

You can test this with bun@1.0.23 and bun@1.0.22, e.g. through brew:

  • $ brew install oven-sh/bun/bun@1.0.23 ❌ fails
  • $ brew install oven-sh/bun/bun@1.0.22 ✅ succeeds

Context

This happens when you create a project with expo-router@~3.4.0 and eslint@^8.56.0. But, the issue itself is related to ajv-keywords having a peer dependency to ajv@8, while ajv@6 is installed. Here is the dependency graph and the installed node_modules structure:

Dependency graph
├── expo-router@3.4.4
│   └── schema-utils@4.2.0
│       ├── ajv@8.12.0
│       └── ajv-keywords@5.1.0 ➡️ Peer depenendency to "ajv@^8.8.2"
└── eslint@8.56.0
    └── ajv@6.12.6


Installed modules
└── node_modules/
    ├── ajv@6.12.6         ➡️ Hoisted from "eslint -> ajv" (and "eslint -> @eslint/eslintrc -> ajv)
    ├── ajv-keywords@5.1.0 ➡️ Hoisted from "expo-router -> schema-utils -> ajv-keywords"
    ├── expo-router@3.4.4  ➡️ Project dependency
    └── eslint@8.56.0      ➡️ Project dependency

As you can see, the installed modules is not correct, as ajv-keywords -> ajv will resolve to ajv@6, not ajv@8. You can validate by running this in the terminal:

# See what version of `ajv` is resolved from `ajv-keywords`
node --print "
  require(
    require.resolve('ajv/package.json', { paths: [
      require.resolve('ajv-keywords/package.json', { paths: [
        require.resolve('schema-utils/package.json', { paths: [
          require.resolve('expo-router/package.json')
        ]})
      ]})
    ]})
  ).version
"
# Returns: 6.12.6

# See the peer dependency constraint of `ajv-keywords`
node --print "
  require(
    require.resolve('ajv-keywords/package.json', { paths: [
      require.resolve('schema-utils/package.json', { paths: [
        require.resolve('expo-router/package.json')
      ]})
    ]})
  ).peerDependencies
"
# Returns: { ajv: '^8.8.2' }
  • With bun@1.0.22, you'll see 8.12.0
  • With bun@1.0.23, you'll see 6.12.6

What is the expected behavior?

Bun should install dependencies properly so that ajv-keywords@5.1.0 can resolve to ajv@8 (and not ajv@6).

$ bun expo start should work fine.

What do you see instead?

Full screenshot

image

Additional information

You can also test with yarn why ajv and yarn why ajv-keywords. For that, run bun install --yarn && yarn why ajv.

@byCedric byCedric added the bug Something isn't working label Jan 23, 2024
@byCedric byCedric changed the title Bun@1.0.23 install violates peer dependency constraints Bun@1.0.23+ install violates peer dependency constraints Jan 23, 2024
@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Jan 23, 2024
@byCedric
Copy link
Author

byCedric commented Feb 1, 2024

@Electroid or @Jarred-Sumner would be good to know if this issue is "accepted" or if it's ignored, I know you all are busy so timeline isn't necessary. I think more people from different communities are experiencing this issue now, and it prevents us from using newer Bun versions.

@Jarred-Sumner
Copy link
Collaborator

@byCedric it's a bug, we will fix it (@dylan-conway, most likely)

We have all been really busy working on Bun for Windows

@byCedric
Copy link
Author

byCedric commented Feb 1, 2024

Awesome, thanks! Yeah, I didn't want to pressure you or anyone else. I just had to know if this was indeed qualified as bug or if it's blamed on something else 😄 Good luck with the Windows support, I know it has been rough.

@Electroid
Copy link
Contributor

Duplicate of #9135

@Electroid Electroid marked this as a duplicate of #9135 Feb 27, 2024
@Electroid Electroid closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2024
@Electroid
Copy link
Contributor

I meant to close the newer issue, not this one, but since it's done will track in #9135

@Jarred-Sumner
Copy link
Collaborator

Just to reiterate - this will be fixed and is being tracked in #9135.

@byCedric
Copy link
Author

byCedric commented Jun 10, 2024

Thanks @Jarred-Sumner! Starting from bun@1.1.11, this issue seems to be resolved.

I did a full test on all bun@1.x.x versions, where the test runs bun expo config --json and checks if the command was executed successfully (ofc with a full node_modules reinstall). Here is the full list of these tests

  • Bun 1.0.0: successful ✅
  • Bun 1.0.1: successful ✅
  • Bun 1.0.2: successful ✅
  • Bun 1.0.3: successful ✅
  • Bun 1.0.4: successful ✅
  • Bun 1.0.5: successful ✅
  • Bun 1.0.6: successful ✅
  • Bun 1.0.7: successful ✅
  • Bun 1.0.8: successful ✅
  • Bun 1.0.9: successful ✅
  • Bun 1.0.10: successful ✅
  • Bun 1.0.11: successful ✅
  • Bun 1.0.12: successful ✅
  • Bun 1.0.13: successful ✅
  • Bun 1.0.14: successful ✅
  • Bun 1.0.15: successful ✅
  • Bun 1.0.16: successful ✅
  • Bun 1.0.17: successful ✅
  • Bun 1.0.18: successful ✅
  • Bun 1.0.19: successful ✅
  • Bun 1.0.20: successful ✅
  • Bun 1.0.21: successful ✅
  • Bun 1.0.22: successful ✅
  • Bun 1.0.23: failed ❌
  • Bun 1.0.24: failed ❌
  • Bun 1.0.25: failed ❌
  • Bun 1.0.26: failed ❌
  • Bun 1.0.27: failed ❌
  • Bun 1.0.28: failed ❌
  • Bun 1.0.29: failed ❌
  • Bun 1.0.30: failed ❌
  • Bun 1.0.31: failed ❌
  • Bun 1.0.32: failed ❌
  • Bun 1.0.33: failed ❌
  • Bun 1.0.34: failed ❌
  • Bun 1.0.35: failed ❌
  • Bun 1.0.36: failed ❌
  • Bun 1.1.0: failed ❌
  • Bun 1.1.1: failed ❌
  • Bun 1.1.2: failed ❌
  • Bun 1.1.3: failed ❌
  • Bun 1.1.4: failed ❌
  • Bun 1.1.5: failed ❌
  • Bun 1.1.6: failed ❌
  • Bun 1.1.7: failed ❌
  • Bun 1.1.8: failed ❌
  • Bun 1.1.9: failed ❌
  • Bun 1.1.10: failed ❌
  • Bun 1.1.11: successful ✅
  • Bun 1.1.12: successful ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants