Skip to content

vp run -r lint fails on Windows in monorepos: OXLINT_TSGOLINT_PATH is set to a root-relative path resolved from the wrong cwd #1747

@dm4t2

Description

@dm4t2

Describe the bug

On Windows, running vp run -r lint (or vp lint for a workspace package) in a pnpm monorepo fails with:

Failed to find tsgolint executable: OXLINT_TSGOLINT_PATH points to
'.\node_modules\.pnpm\vite-plus@0.1.22_...\node_modules\vite-plus\node_modules\.bin\tsgolint.cmd'
which does not exist

The tsgolint executable does exist, the path is just wrong. lint() computes OXLINT_TSGOLINT_PATH as a path relative to process.cwd() of the launcher (the repo root under vp run -r), but oxlint is then spawned with its cwd set to the workspace package directory. The relative .\node_modules\.pnpm\... therefore resolves against packages/<pkg>/, where no .pnpm directory exists (in a pnpm workspace, .pnpm lives only at the repo root).

Root cause

In dist/bin.js, lint() resolves the correct absolute path to tsgolint, then downgrades it to a relative path before exporting it:

if (!oxlintTsgolintPath) throw new Error("Unable to resolve oxlint-tsgolint executable, ...");
const relativePath = relative(process.cwd(), oxlintTsgolintPath);
oxlintTsgolintPath = /^[a-zA-Z]:/.test(relativePath) ? relativePath : `.\\${relativePath}`;

oxlintTsgolintPath is already a valid absolute path at this point. The relative conversion assumes oxlint will run with the same cwd as lint(), which is not true for workspace runs: oxlint receives a path that is relative to the wrong base directory.

(For confirmation: the error string itself is emitted by the oxlint binary, which is correctly reporting that the path it was handed does not exist. The bad value originates here in vite-plus.)

Suggested fix

Keep the resolved absolute path instead of converting it to a launcher-relative path:

if (!oxlintTsgolintPath) throw new Error("Unable to resolve oxlint-tsgolint executable, ...");
// keep the absolute path: oxlint may be spawned with a different cwd (e.g. the workspace
// package dir under `vp run -r`), where a root-relative path would not resolve.

i.e. drop the two relativePath lines. If a relative path is required for some other reason, it should be computed against the directory oxlint is actually spawned in, not the launcher's process.cwd().

Workaround

A local pnpm patch of vite-plus@0.1.22 that removes the relative conversion makes vp lint work correctly across all workspace packages (or use WSL).

Steps to reproduce

  1. pnpm workspace with a package under packages/lib (its own lint script calling vp lint).
  2. .pnpm exists only at the repo root (standard pnpm layout).
  3. On Windows, run vp run -r lint from the repo root.
  4. Lint fails with the OXLINT_TSGOLINT_PATH points to '...' which does not exist error.

Only triggers on process.platform === "win32" (the relative conversion is Windows-only).

System Info

  • vite-plus: 0.1.22 (also present unchanged in latest 0.1.24
  • OS: Windows 11
  • Node: v24.15.0
  • pnpm: 10.25.0
  • oxlint 1.63.0 / oxlint-tsgolint 0.22.1

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Priority

    None yet

    Effort

    None yet

    Target date

    None yet

    Start date

    None yet

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions