-
Notifications
You must be signed in to change notification settings - Fork 72
[BUG] npx runs executables in path instead of wanted package [Windows/Linux] #95
Comments
Same or similar issue with node v12.16.3, npm 6.14.11 running on Ubuntu 18.04 Running
Running the |
I changed the title to add Linux. |
Try npx with npm 7 - if you’re still having issues there, please file an issue in the cli issue. npm 6 as well as this repo are effectively not receiving any more updates. |
I'm not sure if this is an issue, I thought it was the expected behavior. That being said, it took Mac users of Related issue: preset/preset#65 The workaround is to use |
I don’t think there’s a reasonable way to distinguish between a builtin and a globally installed binary, so i think it’s just incumbent in authors to pick binary names that don’t already exist :-/ |
Yeah, that's unfortunate. I think it's possible to distinguish them though, and I don't really see the use case for wanting
|
That would cover local installs, but wouldn't cover global installs, which could be in any location (depending on where the user configured |
My bad, I didn't explain well. I meant that that |
with nvm, global binaries are in |
Ah, I see. I thought they'd always be in this directory relative to the installation path. That said, NPM is aware of which packages are installed globally, right? With that knowledge, it could determine the paths to their binaries? |
No, it’s not necessarily aware of that - /usr/local contains all the system binaries. |
Hm, I'm confused then. If it's not aware of where it installs packages and their binaries, how does it uninstall them? |
That’s a good question :-) it’s aware via various configs, but since some of those can be supplied at the time of the command (which means uninstall would require them too) then npx would require the same invocation args to find everything. |
Either way, i think that it’s just a normal consequence of choosing a binary name that conflicts with a builtin one on some systems. “apply”, like any other builtin Mac command, is something I’d suggest is off limits as a binary name. |
You're right that the name of the binary should be considered wisely. I just wasn't aware of that behavior from Still, if I understood correctly, what you said means that it's possible for Though while I do think it'd be a better default, that'd also be a breaking change, and I can't see that being implemented soon. |
Reproducible with node 14.15.4 installed in a windows 10 machine.
Current Behavior
If an executable exist in the path with the name of the wanted script it overrides
npx
command.Steps to Reproduce
cli.bat
with whatever in a directory that exists on your path.npx @capacitor/cli
Expected Behavior
@capacitor/cli
output should be visibleWhat happens
cli.bat
gets executed.The text was updated successfully, but these errors were encountered: