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: blog@1.0.0
npm ERR! Found: gatsby@4.25.6
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 gatsby-plugin-google-analytics@5.9.0
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?