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: handle spaces in node bin path #711

Merged
merged 1 commit into from
Nov 10, 2023
Merged

Conversation

cristiand391
Copy link
Member

@cristiand391 cristiand391 commented Nov 10, 2023

Reported here:
forcedotcom/cli#2564

plugin-plugins v4 will always perform a check to ensure a plugin exists in npm (npm show <plugin> dist-tags), since it uses the bundled npm instead of the global one it requires to call it using node (so it tries to get the path to node and path to npm-cli.js).

on plugin-plugins v3 this check would only happen if you tried to install a plugin and:

  1. its name didn't include a @
  2. root CLI didn't specify `pjson.oclif.scope

but await this.npmHasPackage(unfriendly) was always silently failing on windows (prob on mac/linux too) if the path to node contains spaces.

if (unfriendly && (await this.npmHasPackage(unfriendly))) {

v4 made npmHasPackage thrown on not found:

// validate that the package name exists in the npm registry before installing
await this.npmHasPackage(name, true)

This PR fixes the error caused on windows when the path to the node binary contains spaces.

@cristiand391 cristiand391 merged commit 0e5f43e into main Nov 10, 2023
13 checks passed
@cristiand391 cristiand391 deleted the cd/fix-node-path-win branch November 10, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants