Skip to content

fix: wrap binary path resolution with fileURLToPath#1177

Merged
nojaf merged 1 commit into
rescript-lang:masterfrom
jderochervlk:vlk/fix-windows-path
Feb 2, 2026
Merged

fix: wrap binary path resolution with fileURLToPath#1177
nojaf merged 1 commit into
rescript-lang:masterfrom
jderochervlk:vlk/fix-windows-path

Conversation

@jderochervlk

Copy link
Copy Markdown
Contributor

The extension was failing to correctly resolve the path on Windows.

node:internal/modules/esm/load:188
    throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, schemes);
          ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, node, and electron are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Adding fileURLToPath uses node's built in way to normalize the file URL so it works across platforms.

...as well as ensuring a cross-platform valid absolute path string

@jderochervlk

Copy link
Copy Markdown
Contributor Author

I tested this out on Windows and the extension now works.

@nojaf
nojaf merged commit 0326ae7 into rescript-lang:master Feb 2, 2026
6 checks passed
@jderochervlk
jderochervlk deleted the vlk/fix-windows-path branch February 2, 2026 15:44
@zeeksphere

Copy link
Copy Markdown

Thanks for the fix! I had the same problem. But in my case it seems to be pathToFileURL, not fileURLToPath, that solves the problem. The issue persists with fileURLToPath.

@davkats

davkats commented Jul 20, 2026

Copy link
Copy Markdown

Thanks for the fix! I had the same problem. But in my case it seems to be pathToFileURL, not fileURLToPath, that solves the problem. The issue persists with fileURLToPath.

Yeah, I agree.

Looking back at the forum thread, my guess is that pathToFileURL() and fileURLToPath() just got mixed up.

https://forum.rescript-lang.org/t/help-vscode-tooling-is-broken-for-me-on-windows/7112

There was a lot of trial and error during the investigation, so I'm not sure the whole code path was ever verified with logging. It's also possible that once a compiler-info file existed, the original error simply stopped happening by coincidence, making it look like this change was the fix.

That said, I think the idea was right. The path does need to be converted to a file URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants