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: Correctly detect local binary when installing via npm #1695

Merged
merged 1 commit into from Jul 26, 2023

Conversation

kamilogorek
Copy link
Contributor

This fixes the nasty issue when using npm to install cli with locally existing binary.
which iterates over all possible binaries available in the PATH, and by default it reports the first occurrence.
This is however problematic when using npm since I believe v8, as they started to include all node_modules/.bin in the PATH when executing npm script, making npm run install detect the bin/sentry-cli file that we have, which is just a JS proxy to the actual binary.
It works fine when running install script directly in node or using yarn, as they don't modify the PATH.

We want the last possible match, eg.

/Users/kamilogorek/Desktop/tmp-cli/node_modules/.bin/sentry-cli,/usr/local/bin/sentry-cli

@kamilogorek kamilogorek requested a review from a team July 26, 2023 15:19
@kamilogorek kamilogorek merged commit 4963c9e into master Jul 26, 2023
16 checks passed
@kamilogorek kamilogorek deleted the local-install-npm branch July 26, 2023 15:27
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.

None yet

2 participants