Open Joris-van-der-Wel opened 3 months ago
PR welcome but I'd need verification that the fix is effective
Same issue. Really unhelpful error message.
I'm running into the same issue, though pnpm ls esbuild
doesn't show anything so it looks like this issue might occur in situations not involving esbuild, too.
Oh, nvm. After patching tsx it looks like I'm getting the same error as @Joris-van-der-Wel.
Here's the patch file I created using pnpm patch
in case it's useful to anyone:
As per the Contribution Guide, I've hid comments that aren't productive towards landing a fix.
@narthur Would you be open to contributing a PR?
@privatenumber Sure, I can take a whack at it.
Same issue
package.json
{
"type": "module"
}
tsx --env-file=.env src/index.ts
node:internal/process/esm_loader:34
internalBinding('errors').triggerUncaughtException(
^
TypeError [Error]: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
at bt (file:///Users/user/node_modules/tsx/dist/index-29948669.mjs:16:1598)
at file:///Users/user/node_modules/tsx/dist/index-29948669.mjs:17:632
at hr (file:///Users/user/node_modules/tsx/dist/index-29948669.mjs:16:1071)
at Cr (file:///Users/user/node_modules/tsx/dist/index-29948669.mjs:17:560)
at Z (file:///Users/user/node_modules/tsx/dist/esm/index.mjs:5:1755)
at async nextLoad (node:internal/modules/esm/hooks:749:22)
at async Hooks.load (node:internal/modules/esm/hooks:382:20)
at async handleMessage (node:internal/modules/esm/worker:199:18)
Version 4.7.1 macOS Sonoma 14.1 Node.js v21.3.0
Version 4.6.2 works fine
Acknowledgements
Minimal reproduction URL
na
Version
4.7.1
Node.js version
20.11.1
Package manager
npm
Operating system
macOS
Problem & Expected behavior
I have my project set up with tsx (macOS), which all works fine. However I wanted to test something in linux, so I created a VM with a bind mount to my project. This caused the node_modules folder that was installed on macOS, to also be used on linux. This is not supported by esbuild: https://github.com/evanw/esbuild/blob/c809af050a74f022d9cf61c66e13365434542420/lib/npm/node-platform.ts#L195
Which is my mistake. However this took me a bit to figure out, because tsx is accidentally hiding this error:
I think this is the code in question: https://github.com/privatenumber/tsx/blob/b39e9b143a9d080286c607f96aaa9f4b8ce8702a/src/utils/transform/index.ts#L28
Manually adding a
console.log(error)
to the minified code in node_modules/tsx, allowed me to figure out what was going on:This error value does not have an "errors" property.
I would suggest changing the code to look like (untested):
Contributions