-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Windows-specific ERR_UNKNOWN_MODULE_FORMAT
#1686
Comments
ERR_INVALID_MODULE_SPECIFIER
(or sometimes ERR_UNKNOWN_MODULE_FORMAT
)ERR_UNKNOWN_MODULE_FORMAT
Does this work? Seems to be working on my end. https://gist.github.com/cspotcode/d84d9bfe1b1d121075865c4ae5991850 |
Yes that appears to work... So what does that do differently? Oh I see, it's a new feature, hot off the press. |
Yeah, I didn't figure out what was going on with your reproduction cuz I figured I'd just try the new feature instead and see if it works. We take care of spawning here: https://github.com/TypeStrong/ts-node/blob/main/src/child/spawn-child.ts |
One thing I did notice:
Assuming a certain relative path might break. Where, exactly, I'm not sure. But you can avoid that risk entirely with Doesn't really matter if you're happy to use |
Yeah, I'd be happy to get rid of my bootstrapper. The only thing it really does is force you to use a bash-like shell, which I can guard against in Node if it really matters. I'll give it a try tomorrow. Thanks! |
I am concurrently trying to create better documentation for this use-case. I've started working on an example project over here: However, it appears as though the shebang I might have to add a new function to our API to support users like you:
This |
You should be able to use this trick in the meantime: |
Dumb question, I'll just try what you have:
Yeah mine is just exiting silently for me. I'll have to meticulously compare mine to yours. Seems unrelated to |
It works, we're good! 👍 👍 👍 Thanks! |
Excellent! Please do file issues and/or message me on Discord if you hit any other problems. I want shebangs and |
Possibly related:
Search Terms
Context
I run my typescript (served via
npx
) throughts-node
so I don't have to maintain a build.Additional Context: #1663
Expected Behavior
The program runs without error. In the case of the linked gist, it runs
hello.ts
, printing "Hello, world!".Actual Behavior
On Windows (CMD or Git Bash, doesn't matter)
For some reason the error gets swallowed:
So I copy and paste what it was supposed to spawn:
It seems like since I've updated to Node.js v17.6.0 it's exclusively erroring with
ERR_UNKNOWN_MODULE_FORMAT
, but I was previously able to provoke aERR_INVALID_MODULE_SPECIFIER
by adding or removingfile:///
for the file argument.nodejs/node#42098 suggests that the code that throws
ERR_UNKNOWN_MODULE_FORMAT
is very new (less than 2 weeks old) and we're well into experimental territory here, but I just thought it was curious that this is only a problem on Windows.Steps to reproduce the problem
Ended up just using the previous gist:
Minimal reproduction
https://gist.github.com/brianjenkins94/d73578d7439427a59df28c1bc751e02d
Specifications
tsconfig.json
Originally posted by @brianjenkins94 in #1663 (comment)
The text was updated successfully, but these errors were encountered: