npm / npx

npm package executor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Unexpected binary invoked

medikoo opened this issue · comments

Current Behavior

I've run following in context of some local package:

npx github-release-from-cc-changelog v2.34.7

With github-release-from-cc-changelog neither being available locally or globally

Instead of github-release-from-cc-changelog binary npx invokes dump-release-notes-from-cc-changelog binary

Expected Behavior

It's github-release-from-cc-changelog binary that should be invoked


I'm using npx as bundled with npm v6.14.7 (not exactly sure which version of npm is that, as npx -v outputs npm verison)

$ npx -v
6.14.7

npx takes a package name, not a bin name, and selects the first bin listed. I don't think there's any way to use npx to invoke alternative binaries in a package.

One workaround might be to create a fourth binary that can dispatch to the other three, and put that first? (or even, to make that the primary interface for the package and only provide one binary)

npx takes a package name ... and selects the first bin listed

Would there be any implications in improving the logic, so it's a binary which matches the package name that is picked (only if it's found, otherwise it could be first in a list, as it happens now)