Skip to content

Commit

Permalink
Use NPM_CLI_JS over npm_execpath
Browse files Browse the repository at this point in the history
npm_execpath points to npx if you are
running this inside of npx
  • Loading branch information
MarmadileManteater committed Oct 28, 2022
1 parent bb41ef6 commit 0224167
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/run-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ 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 = process.env.npm_config_user_agent && process.env.npm_config_user_agent.startsWith("yarn") //eslint-disable-line no-process-env
Expand Down

0 comments on commit 0224167

Please sign in to comment.