Earlier this week, I was getting the following error when trying to install dependencies for a TypeScript-based project:

$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @typescript-eslint/eslint-plugin@6.6.0
npm ERR! Found: @typescript-eslint/parser@5.59.9
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   @typescript-eslint/parser@"^5.59.1" from @vue/eslint-config-typescript@11.0.3
npm ERR!   node_modules/@vue/eslint-config-typescript
npm ERR!     dev @vue/eslint-config-typescript@"^11.0.3" from the root project
npm ERR!   peer @typescript-eslint/parser@"^5.0.0" from @typescript-eslint/eslint-plugin@5.62.0
npm ERR!   node_modules/@vue/eslint-config-typescript/node_modules/@typescript-eslint/eslint-plugin
npm ERR!     @typescript-eslint/eslint-plugin@"^5.59.1" from @vue/eslint-config-typescript@11.0.3
npm ERR!     node_modules/@vue/eslint-config-typescript
npm ERR!       dev @vue/eslint-config-typescript@"^11.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/parser@"^6.0.0 || ^6.0.0-alpha" from @typescript-eslint/eslint-plugin@6.6.0
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR!   dev @typescript-eslint/eslint-plugin@"^6.6.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @typescript-eslint/parser@6.6.0
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^6.0.0 || ^6.0.0-alpha" from @typescript-eslint/eslint-plugin@6.6.0
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     dev @typescript-eslint/eslint-plugin@"^6.6.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

I always find these very hard to read, so I asked ChatGPT to explain me what's happening:

The error message you're seeing is related to a dependency conflict in your Node.js project. It appears that the @typescript-eslint/eslint-plugin package requires a different version of @typescript-eslint/parser than the one specified in your project's dependencies.

So, in my case, I had the following two packages installed which were in conflict:

  • @typescript-eslint/eslint-plugin@5.62.0

  • @typescript-eslint/parser@^6.0.0

My educated guess told me that the @typescript-eslint/eslint-plugin package was the one that needed to be updated (contrary to what ChatGPT was telling me), so I ran the following command (after first checking the latest version of the package on npmjs.com):

npm install @typescript-eslint/eslint-plugin@^6.0.0

That was all what was needed to get the packages to install again.