[Node] Run Local DevDependencies from the Command Line with npx

In the past, you've needed to either write a package.json script or use the node_modules/.bin directory to access binaries installed in your node_modules. npx enables you to access the binaries much more easily and try out options before you settle on what you want to add to your package.json scripts.

In command line, you can do:

npx webpack --optimize-minimize index.js bundle.js

to test out the command.

Instead of:

{
  "scripts": {
      "build": "webpack --optimize-minimize index.js bundle.js"
  }
}
原文地址:https://www.cnblogs.com/Answer1215/p/7217790.html