When npm install was installed, the system added commands such as “mocha”,”n and” n “.How did this happen

  node.js, question

For example, when npm install is in progress, the system will add relevant commands, the global installation will be added to the global, and the local installation will be added to the local.
What I know now is that after the’ bin’ attribute is set under packge.json, running npm link will establish a command link.
thatnpm installHow did you do it? Will automatically executenpm link?

For examplenpm install -g http-server