1
votes

I've written a CLI tool in JavaScript and I'm planning to use it with npx so that users are able to install and run in a single command:

npx mypackage

The problem with the command above is that my package gets downloaded and run, but without its dependencies, so it fails immediately:

 Error: Cannot find module 'lodash'

package.json looks like this:

{
  "name": "mypackage",
  "bin": "start.js",
  "dependencies": {
    "lodash": "^4.17.21"
  }
}