zkat / npx

execute npm package binaries (moved)
https://github.com/npm/npx
Other
2.63k stars 105 forks source link

cannot run "npx @babel/cli" #240

Closed mo closed 5 years ago

mo commented 5 years ago

Even if there is a binary called "cli" on the $PATH, why would it be executed when I do "npx @babel/cli" ?

mo commented 5 years ago

I just read the npx man page and realized that I had misunderstood how npx works. I always thought you typed "npx foo" to execute the main cli script from package named "foo" but in reality it seems that "npx foo" means run "foo" if it exists on the $PATH, otherwise try to guess what package "foo" comes from, install that and run the "foo" binary from that. In light of that, the correct invocation is:

npx -p @babel/cli -p @babel/core babel SOME PARAMS HERE