Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix npm install --prefix on windows #7725

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ class Install extends ArboristWorkspaceCmd {

async exec (args) {
// the /path/to/node_modules/..
const globalTop = resolve(this.npm.globalDir, '..')
const ignoreScripts = this.npm.config.get('ignore-scripts')
const isGlobalInstall = this.npm.global
const where = isGlobalInstall ? globalTop : this.npm.prefix
const where = this.npm.prefix
const forced = this.npm.config.get('force')
const scriptShell = this.npm.config.get('script-shell') || undefined

Expand Down Expand Up @@ -128,13 +127,13 @@ class Install extends ArboristWorkspaceCmd {
args = args.filter(a => resolve(a) !== this.npm.prefix)

// `npm i -g` => "install this package globally"
if (where === globalTop && !args.length) {
if (isGlobalInstall && !args.length) {
args = ['.']
}

// throw usage error if trying to install empty package
// name to global space, e.g: `npm i -g ""`
if (where === globalTop && !args.every(Boolean)) {
if (isGlobalInstall && !args.every(Boolean)) {
throw this.usageError()
}

Expand Down