我在尝试安装 npm 软件包时遇到问题,希望得到一些帮助。详情如下:
错误信息:
(node:1479) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
(Use 'node --trace-warnings ...' to show where the warning was created)
我按照文档操作,运行 npm i -D @waline/client,并遇到上述错误。 为了排除故障,我使用 npm init 启动了一个新项目,然后尝试 npm install -g yarn。令人惊讶的是,同样的错误!
我还没有写一行代码。 每次运行 npm install 时都会出现该错误。
我的设置: 节点版本:v20.8.1 NPM版本:10.1.0
有人可以帮助我了解此问题的原因并提供解决指导吗?
也许是因为 GFW。 您应该使用代理。
事实上,确实是因为中国大陆的网络问题。即使节点可能存在问题。我在香港和美国测试过,没有发现问题。
npm config set proxy http://127.0.0.1:1080
或:
用于传出 http 请求的代理。如果设置了 HTTP_PROXY 或 http_proxy 环境变量,底层请求库将遵循代理设置。
yarn config set httpProxy http://127.0.0.1:1080
yarn config set httpsProxy http://127.0.0.1:1080
# You should know the proxy.