From aa86e2ae6ad3f7fe073103fa15ec50dbdf141d70 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Mon, 23 Oct 2023 14:06:36 -0600 Subject: [PATCH] fix: resolve yarn from plugin and config.root --- src/yarn.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/yarn.ts b/src/yarn.ts index d5caa402..d4498f0e 100644 --- a/src/yarn.ts +++ b/src/yarn.ts @@ -3,6 +3,7 @@ import makeDebug from 'debug' import {fork} from 'node:child_process' import {createRequire} from 'node:module' import {join} from 'node:path' +import {fileURLToPath} from 'node:url' import NpmRunPath from 'npm-run-path' import {WarningsCache} from './util.js' @@ -24,7 +25,8 @@ export default class Yarn { constructor({config}: {config: Interfaces.Config}) { this.config = config - this.bin = require.resolve('yarn/bin/yarn.js') + this.bin = require.resolve('yarn/bin/yarn.js', {paths: [fileURLToPath(import.meta.url), config.root]}) + debug('yarn binary path', this.bin) } async exec(args: string[] = [], opts: YarnExecOptions): Promise {