Search code examples
reactjsnpx

Max listeners exceeded when creating react app


When I create a new react app using the following command

npx create-react-app ./

I get the following error

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

I tried increasing the maximum number of listeners but it didn't solve the problem I'm using node 20.4.0


Solution

  • Since you are using Node.js v20, you need to downgrade to v18.

    create-react-app do not have support for v20 (as it supports only upto the latest LTS version, which is v18).

    That should fix the issue you are seeing.