'Npm dependency conflict - how to solve it?

I am trying to install graphql-iso-date. Can someone tell me how to fix this?

npm ERR! code ERESOLVE  
npm ERR! ERESOLVE unable to resolve dependency tree  
npm ERR!  
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/graphql
npm ERR!   graphql@"^16.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer graphql@"^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0" from [email protected]
npm ERR! node_modules/graphql-iso-date
npm ERR!   graphql-iso-date@"*" 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! See C:\Users\Simon\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Simon\AppData\Local\npm-cache\_logs\2022-01-11T19_26_53_815Z-debug-0.log
npm


Solution 1:[1]

this has occured because the peer dependencies were conflicting for new versions of npm. the package is not so well maintained.

use --legacy-peer-deps with your command.

exact command would be : npm install graphql-iso-date --legacy-peer-deps

use --save flag if you need.

Solution 2:[2]

I tried --legacy-peer-deps but nothing worked for me so I tried Running: npm i -g npm@next-7 and it worked for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vishwa
Solution 2 Tyler2P