简体   繁体   English

为什么http模块不在node_modules文件夹中?

[英]Why http module is not located in the node_modules folder?

My question is what is the difference between http module and other modules in node.js . 我的问题是http模块和node.js中的其他模块之间有什么区别? why is the http module not located in ./node_modules ? 为什么http模块不在./node_modules Where I can find the module? 在哪里可以找到该模块?

The http module is provided by your installation of Node.js. http模块由您的Node.js安装提供。 It's what's known as a core module 这就是所谓的核心模块

You can view the source to them in the repo (or download them locally): https://github.com/nodejs/node/tree/master/lib 您可以在仓库中查看源代码(或在本地下载): https : //github.com/nodejs/node/tree/master/lib

  • HTTP modules are compiled into its binary distribution and load automatically when Node.js process starts. HTTP模块被编译成其二进制发行版,并在Node.js进程启动时自动加载。 but, you need to import the core module first in order to use it in your application. 但是,您需要先导入核心模块才能在应用程序中使用它。
  • var http = require('http');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM