gpt4 book ai didi

node.js - 为什么 http 模块不在 node_modules 文件夹中?

转载 作者:搜寻专家 更新时间:2023-11-01 00:19:32 24 4
gpt4 key购买 nike

我的问题是 http 模块和 node.js 中的其他模块有什么区别。为什么 http 模块不在 ./node_modules 中?我在哪里可以找到该模块?

最佳答案

http 模块由您安装的 Node.js 提供。这就是所谓的 core module

您可以在存储库中查看它们的源代码(或在本地下载):https://github.com/nodejs/node/tree/master/lib

更新

从 Node 18 开始,您可以通过在核心模块前加上 node: 来引用它们,这确保您不会加载共享相同名称的依赖项。

const http = require('node:http');

关于node.js - 为什么 http 模块不在 node_modules 文件夹中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55311493/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com