diff --git a/lib/run-task.js b/lib/run-task.js index f41da39..7c1b1e1 100644 --- a/lib/run-task.js +++ b/lib/run-task.js @@ -153,10 +153,10 @@ module.exports = function runTask(task, options) { } // Execute. - const npmPath = options.npmPath || process.env.npm_execpath //eslint-disable-line no-process-env + const npmPath = options.npmPath || process.env.NPM_CLI_JS || process.env.npm_execpath //eslint-disable-line no-process-env const npmPathIsJs = typeof npmPath === "string" && /\.m?js/.test(path.extname(npmPath)) const execPath = (npmPathIsJs ? process.execPath : npmPath || "npm") - const isYarn = path.basename(npmPath || "npm").startsWith("yarn") + const isYarn = process.env.npm_config_user_agent && process.env.npm_config_user_agent.startsWith("yarn") //eslint-disable-line no-process-env const spawnArgs = ["run"] if (npmPathIsJs) {