-
Notifications
You must be signed in to change notification settings - Fork 223
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
ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows with ESM #201
Comments
Hey! A PR to use relative paths in this case seems reasonable. That wouldn't solve the cross drive issues, but it would the more basic problem here. Honestly that seems like a good middle ground to me. |
1 task
@wesleytodd I put in a PR for this that imports using File URL's instead - that fixed the issue on windows for me. #202 |
wesleytodd
pushed a commit
that referenced
this issue
Nov 21, 2023
wesleytodd
pushed a commit
that referenced
this issue
Nov 21, 2023
wesleytodd
pushed a commit
that referenced
this issue
Nov 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using the API (not sure if it's the same issue with the migrate CLI), node throws a
ERR_UNSUPPORTED_ESM_URL_SCHEME
error when ESM scripts are used on Windows. It doesn't seem to like the resolved path starts withC:\
or whatever letter of the drive is being used.I've pinpointed the issue to
node-migrate/lib/load-migrations.js
Line 48 in 1ed0f4c
migrationsDirectory
, it is converted into an absolute path due tonode-migrate/lib/load-migrations.js
Line 18 in 1ed0f4c
I'm not sure what the solution is, as it's node not working with absolute paths on Windows with
import
. This isn't an issue withrequire
nor is it an issue with an absolute path on MacOS or Linux.I've tried a few different scenarios in the REPL, and using a POSIX path in Windows does work (e.g. using
/path/to/migrations
works whereC:\\path\\to\\migrations
doesn't). But obviously that doesn't help if the migrations directory is on a different mapped drive.I was struggling to see where this issue was coming from, so I thought it was at least useful to raise something here in case someone else comes across this.
Related Node issue nodejs/node#31710.
Prefixing the path with
file:\\
orfile://
works, so maybe that should be done when usingimport
(as it breaksrequire
)?The text was updated successfully, but these errors were encountered: