How is use of npm to install global packages that don't even get used in Node applications justified?

后端 未结 4 1177
小鲜肉
小鲜肉 2021-01-06 00:52

My knowledge of npm is this:

It is a package manager for Node.js applications. What this means is that when you need someone else\'s librar

4条回答
  •  情书的邮戳
    2021-01-06 01:49

    Sounds like your primary question is not how, but why?

    The distinction here is between a node package vs a node module.

    Only *module*s are meant to be require()ed by other node applications, and not all packages on npm need be modules. There are very many useful node packages that are only indirectly related to node. E.g., gulp or grunt or cordova or cca, etc.

    These answers come (reworded) directly from the npm faq

    For cca specifically, we hope to have a node module in the future, so the question of "why npm" is just forward thinking. Additionally, cca is a downstream distribution of cordova (just like phonegap) which was always hosted on npm, and we wanted to continue that heritage.

提交回复
热议问题