npx #

Last updated March 11, 2026
javascriptnpm

npx lets you create a command line tool that can be run without already having it installed. To turn your npm module into such a command give it should have a javascript file with a shebang line like this: #!/usr/bin/env node. This can be in your Typescript file and the compiler should make sure it ends up in the final output js file.

Then in your package.json file needs a bin entry pointing to the script like this:

{
  "bin": {
    "amx": "build/cli.js"
  }
}

Now publish your module and run it from another shell with npx -g modulename