Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

MODULE_NOT_FOUND from @esbuild-kit/cjs-loader due to core-utils update #47

Closed
2 tasks
Shinigami92 opened this issue Aug 28, 2023 · 11 comments
Closed
2 tasks
Labels
bug Something isn't working released

Comments

@Shinigami92
Copy link

Problem

While updating devDependencies, @esbuild-kit/core-utils got updated from 3.1.0 to 3.2.0, I now get following error when running my node server:

node:internal/modules/cjs/loader:1048
  const err = new Error(message);
              ^

Error: Cannot find module './**/*'
Require stack:
- /path-to-project/node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
- /path-to-project/node_modules/.pnpm/bcrypt@5.1.0/node_modules/bcrypt/bcrypt.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at u.default._resolveFilename (/path-to-project/node_modules/.pnpm/@esbuild-kit+cjs-loader@2.4.2/node_modules/@esbuild-kit/cjs-loader/dist/index.js:1:1519)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at <anonymous> (/path-to-project/node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js:86:22)
    at Object.<anonymous> (/path-to-project/node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js:309:2)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Object.F (/path-to-project/node_modules/.pnpm/@esbuild-kit+cjs-loader@2.4.2/node_modules/@esbuild-kit/cjs-loader/dist/index.js:1:941)
    at Module.load (node:internal/modules/cjs/loader:1091:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/path-to-project/node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js',
    '/path-to-project/node_modules/.pnpm/bcrypt@5.1.0/node_modules/bcrypt/bcrypt.js'
  ]
}

Node.js v20.5.1

Expected behavior

No error
When I use
image

everything is fine

Minimal reproduction URL

Version

v3.2.0

Node.js version

v20.5.1

Package manager

pnpm

Operating system

macOS

Contributions

  • I plan to open a pull request for this issue
  • I plan to make a financial contribution to this project
@Shinigami92 Shinigami92 added the bug Something isn't working label Aug 28, 2023
@privatenumber
Copy link
Member

Could you work on a reproduction? I'd like to help debug but not sure if I can with just the trace.

@Shinigami92
Copy link
Author

Could you work on a reproduction? I'd like to help debug but not sure if I can with just the trace.

Yeah I can try, but give me some time, so I can extract it
I'm also working right now, so it could be in some hours...

@privatenumber
Copy link
Member

I'm not sure if it will fix it but I just released https://github.com/esbuild-kit/core-utils/releases/tag/v3.2.1 to address a Node 12 compatibility issue.

FWIW, I tried installing bcrypt and it runs fine with the latest tsx, core-utils, and Node v20.5.1.

@Shinigami92
Copy link
Author

Sadly it doesn't fixed it
Will try to create the repro in evening

@MariuzM
Copy link

MariuzM commented Aug 28, 2023

Same for me this new version just killed it

@MariuzM
Copy link

MariuzM commented Aug 28, 2023

This is sample lock file before and after
image

and this is hard to reproduce because i use tsx and that uses this peer deep that i dont really have control over. I regullary delete lock file just to check stability of deps like sometimes 2 times a day. and today i found this. Yesterday no issues

@privatenumber
Copy link
Member

Can you provide a reproduction? As I said above, I can't really help if I cant debug.

@MariuzM
Copy link

MariuzM commented Aug 28, 2023

@privatenumber repo might also be related with sharp
https://github.com/MariuzM/sharp-esbuild-issues

@privatenumber
Copy link
Member

Thanks, that helped.

I filed a bug in esbuild: evanw/esbuild#3353

For now, I'll downgrade to v0.18

@privatenumber
Copy link
Member

🎉 This issue has been resolved in version 3.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Shinigami92
Copy link
Author

Can confirm, 3.2.2 fixed it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

3 participants