Is it possible to execute command line tools under windows only if npm is installed globally?

  node.js, question

such asmocha, I only install it in the project:

npm install mocha

Now I’m under windowscmdCommand line tools to run it:


It can’t be done.

Does it have to be installed globallynpm install -g mochaTo run its command line tools?

I know it can be done throughpackage.jsonInside configurationscriptscomenpm run xx.

If you develop under window, it is recommended to install git first. After installation, you will have a linux-like environment-Gitbash’s shell:


There is no problem with the operation.

In fact, as long as we understand that npm install -g xx not only installs xx module into the global environment, but also injects the command /.bin/ carried by xx module into the global environment, so that you can use mocha xxx in the shell