zkat / npx

execute npm package binaries (moved)

Home Page:https://github.com/npm/npx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot run "npx @babel/cli"

mo opened this issue · comments

  • on ubuntu 19.04
  • run "npx @babel/cli"
  • This command prints "Usage is: mono [options] program [program-options]"
    Which is some kind of usage info for a util involving mono-project.com
  • running just "cli" prints the same message

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

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