Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-08-03 18:36:47 +0300
committerGitHub <noreply@github.com>2022-08-03 18:36:47 +0300
commit19a834610d154f36748536b27aed13bfdb5ee748 (patch)
treed8d40f8f8061d6b7813f20801028c3312cb74220 /lib
parent8233fca44321186c485964d26aa3c7c43eafff3d (diff)
fix: properly find and run global scoped packages (#5250)
Diffstat (limited to 'lib')
-rw-r--r--lib/commands/exec.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/commands/exec.js b/lib/commands/exec.js
index 85a71923f..ddbb5f7cf 100644
--- a/lib/commands/exec.js
+++ b/lib/commands/exec.js
@@ -1,3 +1,4 @@
+const path = require('path')
const libexec = require('libnpmexec')
const BaseCommand = require('../base-command.js')
@@ -24,7 +25,7 @@ class Exec extends BaseCommand {
async exec (_args, { locationMsg, runPath } = {}) {
// This is where libnpmexec will look for locally installed packages
- const path = this.npm.localPrefix
+ const localPrefix = this.npm.localPrefix
// This is where libnpmexec will actually run the scripts from
if (!runPath) {
@@ -37,6 +38,7 @@ class Exec extends BaseCommand {
flatOptions,
localBin,
globalBin,
+ globalDir,
} = this.npm
const output = this.npm.output.bind(this.npm)
const scriptShell = this.npm.config.get('script-shell') || undefined
@@ -57,9 +59,10 @@ class Exec extends BaseCommand {
localBin,
locationMsg,
globalBin,
+ globalPath: path.resolve(globalDir, '..'),
output,
packages,
- path,
+ path: localPrefix,
runPath,
scriptShell,
yes,