小编Par*_*bet的帖子

在 macOS 上安装或创建 Node.js 项目时出现 MaxListenersExceededWarning

当我尝试在 macOS (darwin) 上安装或创建 Node.js 项目时,收到以下警告消息:

(node:80101) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit

在多次看到警告后,我已将 Node.js 更新到最新版本(V20.5.1),并且 npm 已经是最新版本(V9.8.1)。我没有使用任何第三方工具,我只是使用终端。

我收到警告后的命令是: npm install ...npx ...
执行这些命令后我至少收到一次警告消息(通常是多次)。

我正在处理的项目甚至没有 NodeJS 文件,两次我都忙于 React 和下一个项目(我认为这是无关紧要的,因为在任何项目之外的终端中使用 NPM 时我都会看到相同的警告)。

如果有人能帮助我,我将不胜感激。到目前为止,除了警告本身之外,我还没有注意到项目或安装过程中有任何问题,但我不明白为什么当我没有对 NPM 或节点中的任何配置进行任何更改时会弹出警告。

尝试使用 NPM 安装软件包并使用 NPX 创建项目,这两者都会导致相同的警告(有时在安装或创建过程完成之前多次):

(node:80101) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit

javascript node.js npm npm-install npx

10
推荐指数
1
解决办法
4453
查看次数

标签 统计

javascript ×1

node.js ×1

npm ×1

npm-install ×1

npx ×1