mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-24 22:14:37 +00:00
fix: force reinstall in which() when .bin is missing
When the lockfile exists but .bin is empty or absent, add() would read the lockfile via loadVirtual() and return early without calling reify(). Delete the lockfile before calling add() so it proceeds with a full install.
This commit is contained in:
parent
34c676ba7a
commit
c075a5d694
1 changed files with 2 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ import { Global } from "../global"
|
|||
import { Lock } from "../util/lock"
|
||||
import { Log } from "../util/log"
|
||||
import path from "path"
|
||||
import { readdir } from "fs/promises"
|
||||
import { readdir, rm } from "fs/promises"
|
||||
import { Filesystem } from "@/util/filesystem"
|
||||
|
||||
const { Arborist } = await import("@npmcli/arborist")
|
||||
|
|
@ -172,6 +172,7 @@ export namespace Npm {
|
|||
const bin = await pick()
|
||||
if (bin) return path.join(binDir, bin)
|
||||
|
||||
await rm(path.join(dir, "package-lock.json"), { force: true })
|
||||
await add(pkg)
|
||||
const resolved = await pick()
|
||||
if (!resolved) throw new Error(`No binary found for package "${pkg}" after install`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue