deleted node modules still getting conflicting peer dependency

127 views Asked by At

I'm trying to build a gatsby project. My project didn't had any package conflict until I installed google analytics plugin.

I am getting dependency error even after deleting node_modules, package-lock.json, .cache.

The log:

pegasus@pegasus:~/Documents/Final_Website/blog$ npm install gatsby-plugin-mdx gatsby-source-filesystem @mdx-js/react
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/gatsby
npm ERR!   gatsby@"^4.10.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby@"^5.0.0-next" from [email protected]
npm ERR! node_modules/gatsby-plugin-google-analytics
npm ERR!   gatsby-plugin-google-analytics@"^5.9.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.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /home/pegasus/.npm/_logs/2023-05-04T05_04_02_747Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pegasus/.npm/_logs/2023-05-04T05_04_02_747Z-debug-0.log

How to resolve it?

1

There are 1 answers

0
Trott On

The error message says that gatsby-plugin-google-analytics requires gatsby@5 but your project is using/requiring gatsby@4. Your options are:

  1. Update your project to Gatsby 5.
  2. Install an earlier version of the analytics plugin that is compatible with Gatsby 4.
  3. Take your chances with npm install --legacy-peer-deps which will probably install everything just fine but you might end up running into bugs/incompatibilities.
  4. Uninstall the analytics plugin.