[PR #12636] fix(nix): handle missing .bun directory in canonicalize-node-modules #14305

Closed
opened 2026-02-16 18:19:06 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12636

State: closed
Merged: No


Summary

  • Use safeReadDir and isDirectory helpers (consistent with normalize-bun-binaries.ts)
  • Replace dynamic semver import with Bun.semver.order

Problem

Since d29dfe31e ("chore: reduce nix fetching (#11660)" by @gigamonster256), bun install uses --filter flags which may not create the node_modules/.bun directory. This causes canonicalize-node-modules.ts to fail with:

ENOENT: no such file or directory, scandir '.../node_modules/.bun'

Root Cause

The nix-desktop workflow was disabled in a92b7923c by @thdxr without replacement. Nix package builds are no longer tested in CI, allowing regressions like this to be merged.

A pre-merge nix-eval workflow like #12175 would have caught this.

Solution

  • Use safeReadDir to gracefully handle missing directory (same pattern as normalize-bun-binaries.ts)
  • Use Bun.semver.order instead of importing semver from .bun/node_modules
  • Add isDirectory helper for consistency

Fixes #12632, #12603, #12602

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12636 **State:** closed **Merged:** No --- ## Summary - Use `safeReadDir` and `isDirectory` helpers (consistent with `normalize-bun-binaries.ts`) - Replace dynamic `semver` import with `Bun.semver.order` ## Problem Since d29dfe31e ("chore: reduce nix fetching (#11660)" by @gigamonster256), bun install uses `--filter` flags which may not create the `node_modules/.bun` directory. This causes `canonicalize-node-modules.ts` to fail with: ``` ENOENT: no such file or directory, scandir '.../node_modules/.bun' ``` ## Root Cause The nix-desktop workflow was disabled in a92b7923c by @thdxr without replacement. Nix package builds are no longer tested in CI, allowing regressions like this to be merged. A pre-merge nix-eval workflow like #12175 would have caught this. ## Solution - Use `safeReadDir` to gracefully handle missing directory (same pattern as `normalize-bun-binaries.ts`) - Use `Bun.semver.order` instead of importing semver from `.bun/node_modules` - Add `isDirectory` helper for consistency Fixes #12632, #12603, #12602
yindo added the pull-request label 2026-02-16 18:19:06 -05:00
yindo closed this issue 2026-02-16 18:19:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14305