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 install builds different node_modules structure since 1.0.23 #8201

Closed
shyim opened this issue Jan 16, 2024 · 4 comments · Fixed by #11473
Closed

bun install builds different node_modules structure since 1.0.23 #8201

shyim opened this issue Jan 16, 2024 · 4 comments · Fixed by #11473
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@shyim
Copy link

shyim commented Jan 16, 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?

Simplified example

Create an empty directory and run:

  • npm install babel-loader eslint/eslintrc --save

ajv seems to miss files:

find . | grep ajv/dist/compile/codegen

NPM:

./node_modules/ajv/dist/compile/codegen
./node_modules/ajv/dist/compile/codegen/code.d.ts
./node_modules/ajv/dist/compile/codegen/code.js
./node_modules/ajv/dist/compile/codegen/code.js.map
./node_modules/ajv/dist/compile/codegen/scope.d.ts
./node_modules/ajv/dist/compile/codegen/index.js
./node_modules/ajv/dist/compile/codegen/scope.js
./node_modules/ajv/dist/compile/codegen/index.js.map
./node_modules/ajv/dist/compile/codegen/index.d.ts
./node_modules/ajv/dist/compile/codegen/scope.js.map

Bun: (bun install --no-save)

./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.d.ts
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.d.ts
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js.map
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.d.ts
./node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js.map
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.d.ts
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.js
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.js.map
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.d.ts
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.js
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.js
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.js.map
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.d.ts
./node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.js.map

My CI failure

Webpack + babel-loader installed with bun, fails later to run with node

Package.json

Module build failed (from ../node_modules/babel-loader/lib/index.js):
426Error: Cannot find module 'ajv/dist/compile/codegen'

NPM:

❯ find . | grep babel-loader/node_modules/ajv/dist/compile/codegen
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/code.d.ts
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/code.js
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/code.js.map
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/scope.d.ts
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/index.js
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/scope.js
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/index.js.map
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/index.d.ts
./node_modules/babel-loader/node_modules/ajv/dist/compile/codegen/scope.js.map

Bun:

❯ find . | grep babel-loader/node_modules/ajv/dist/compile/codegen

What is the expected behavior?

Bun install works like NPM, like previous versions

What do you see instead?

No response

Additional information

No response

@shyim shyim added the bug Something isn't working label Jan 16, 2024
@shyim
Copy link
Author

shyim commented Jan 16, 2024

Maybe a better reproducer:

ERROR in ./foo.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'ajv/dist/compile/codegen'
Require stack:
- /Users/shyim/Downloads/webpack-reproduce/node_modules/ajv-keywords/dist/definitions/typeof.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/ajv-keywords/dist/keywords/typeof.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/ajv-keywords/dist/keywords/index.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/ajv-keywords/dist/index.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/schema-utils/dist/validate.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/schema-utils/dist/index.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/babel-loader/lib/index.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/loader-runner/lib/loadLoader.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/loader-runner/lib/LoaderRunner.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/webpack/lib/NormalModuleFactory.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/webpack/lib/Compiler.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/webpack/lib/webpack.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/webpack/lib/index.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/webpack-cli/lib/webpack-cli.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/webpack-cli/lib/bootstrap.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/webpack-cli/bin/cli.js
- /Users/shyim/Downloads/webpack-reproduce/node_modules/webpack/bin/webpack.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/shyim/Downloads/webpack-reproduce/node_modules/ajv-keywords/dist/definitions/typeof.js:3:19)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)

webpack 5.89.0 compiled with 1 error in 102 ms

@arvinxx
Copy link

arvinxx commented Jan 16, 2024

@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Jan 16, 2024
@arvinxx
Copy link

arvinxx commented Jan 17, 2024

@Electroid is there any fixture with it? it may casue our project failed to build after vercel bump the bun version to 1.0.23

@Amurmurmur
Copy link

bun -D add ajv-keywords

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.

4 participants