我很困惑npm是一个包管理器,但是Node.js有模块。 所以当你安装或创建自己的...... erhmm,模块,包? 选择哪个词而不是另一个?
I am confused npm is a package manager, but Node.js has modules. So when you install or create your own... erhmm, module, package? Which word to choose over another and when?
最满意答案
看一下docs http://nodejs.org/docs/latest/api/modules.html :
在节点中,文件和模块是一一对应的。
另一方面,package是一个包含特殊package.json文件的文件夹。 该文件告诉解释器如何在require(folder);时加载模块require(folder); 。 换句话说,package是模块的集合。
Have a look at docs http://nodejs.org/docs/latest/api/modules.html :
In Node, files and modules are in one-to-one correspondence.
On the other hand package is a folder with a special package.json file in it. That file tells the interpreter how to load modules when you do require(folder);. In other words package is a collection of modules.
更多推荐
发布评论