Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Binary resolution fails on Windows with ERR_INVALID_URL_SCHEME when compiler-info.json is missing

オープン 初心者向け
#1,184 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
node.js, typescript
領域
devtools

調査の方向性

まず、compiler-info.json が存在しない場合に targetPackagePath をインポートするフォールバックのバイナリ解決コードを見つけ、PR #1177 の変更を確認してください。報告されている Node バージョンで Windows の失敗を再現し、フォールバックが compiler-info.json なしでバイナリを正常に解決することを検証してください。パス処理に関連するコンテキストについては #1181 も確認してください。

索引モデルが issue の本文から書いたものです。

説明

Environment

  • OS: Windows 10 x64
  • VS Code extension: v1.73.11 (Pre-release)
  • Language Server: v1.72.0
  • ReScript: 12.3.0
  • Node: tested with 20.20.2, 22.23.1, and 24.18.0

Problem

When compiler-info.json is missing, the language server falls back to resolving binaries through:

await import(url.fileURLToPath(targetPackagePath))

On Windows this consistently throws:

TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file

As a result, the language server cannot resolve ReScript binaries through the fallback path.

Investigation

This only happens when:

  • ReScript version is >= 12.0.0-alpha.13
  • compiler-info.json does not exist, causing the fallback code path to execute.

If compiler-info.json exists (for example after a successful build), this code path is skipped, making the issue difficult to notice.

I reproduced the problem outside of the extension using a minimal Node script.

For the same filesystem path:

D:\...\node_modules\@rescript\win32-x64\bin.js

I tested all supported approaches.

1.
await import(path)

Result on Node 20, 22 and 24:

ERR_UNSUPPORTED_ESM_URL_SCHEME
2. (current implementation)
await import(fileURLToPath(path))

Result on Node 20, 22 and 24:

ERR_INVALID_URL_SCHEME

This happens because fileURLToPath() expects a file:// URL, but path is already a filesystem path.

3.
await import(pathToFileURL(path).href)

Result:

Works correctly on Node 20, Node 22 and Node 24.

Since the value being imported is already a filesystem path (as the variable name also suggests) and is immediately passed to import(), converting it with pathToFileURL() matches the intended Node.js API for dynamic ESM imports.

Although I only tested this on Windows, this should behave consistently across platforms because pathToFileURL() converts native filesystem paths into valid file:// URLs on both Windows and POSIX systems.

Expected fix

It looks like the fallback should import a file URL, not convert a filesystem path with fileURLToPath().

Replacing

await import(fileURLToPath(targetPackagePath))

with

await import(pathToFileURL(targetPackagePath).href)

resolved the issue in all of my Windows tests.

Since the imported value is already a filesystem path, this should also be the correct cross-platform approach rather than a Windows-specific workaround.

I also noticed that PR #1177 introduced the current fileURLToPath() implementation. Based on my testing, it looks like the original issue (await import(path)) was replaced with another issue caused by calling fileURLToPath() on an existing filesystem path.

This may also be related to #1181 since both issues involve Windows path handling during binary resolution.

主要言語
ReScript
スター
356
フォーク
63
平均マージ
11時間 29分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rescript-lang/rescript-vscode のほかの issue

rescript-lang/rescript-vscode の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。