镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Better way to resolve binary path when node_modules/ doesn't exist #1170

Open

Description

@folliehiyuki

The issue is similar to #638.

Affected setup

  • Native Deno project, where packages are only installed into Deno's global cache and no node_modules/ compatibility directory is exposed.
  • Yarn-berry project in PnP mode (pnpm also supports this setup) where all dependencies are installed into Yarn's global cache as ZIP archives and they are resolved using a JS loader file at project root.
  • The user might want to use rescript/rewatch binary packaged by a downstream distribution (.e.g Nixpkgs)

Setting a custom value for settings.platformPath / settings.binaryPath is undesirable since the parent directory of the binary might not be obvious (in case 2 and 3 above).

Suggestion

We could have special logic to deal with Deno and PnP cases, and optionally search the user's PATH for the binary if they want to.

Activity

  1. nojaf commented on Dec 26, 2025

    @nojaf
    Contributor

    special logic to deal with Deno and PnP cases

    I'm quite skeptical to add more logic for these cases.
    From the maintainer's point of view: where does it end?

    I think taking some absolute paths for bsc.exe and rescript-editor-analysis.exe in configuration would be reasonable first step.

    PS: I would imagine a rescript build also doesn't quite work in these scenarios.
    If they do, do they provide a valid lib/bs/compiler-info.json file?

  2. folliehiyuki commented on Dec 26, 2025

    @folliehiyuki
    Author

    PS: I would imagine a rescript build also doesn't quite work in these scenarios.
    If they do, do they provide a valid lib/bs/compiler-info.json file?

    rescript build is usually invoked as a npm/yarn/pnpm/deno script target, so the package manager already takes care of prepending the package's bin/ directory to the user's PATH. The lack of node_modules/ directory is not an issue in this case.

    Though, being able to run the custom binary from the system (.e.g in /usr/bin/) instead of the package's pre-built binaries is a bit more complex. In this situation, I'll have to mask all optional dependencies.

  3. nojaf commented on Dec 26, 2025

    @nojaf
    Contributor

    rescript build is usually invoked as a npm/yarn/pnpm/deno script target, so the package manager already takes care of prepending the package's bin/ directory to the user's PATH. The lack of node_modules/ directory is not an issue in this case.

    It is a bit more complex than that.
    The rescript script needs to find the runtime and bsc.exe binary before it invokes the rust (rewatch) binary. So, I'm wondering if all that even worked out.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions