'unable to install express-graphql

I am trying to install express-graphql but getting this error.Please help

npm install --save express-graphql 
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/graphql
npm ERR!   graphql@"^16.2.0" from the root project 
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer graphql@"^14.7.0 || ^15.3.0" from [email protected]
npm ERR! node_modules/express-graphql
npm ERR!   express-graphql@"*" 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.


Solution 1:[1]

Delete full Initialized project then

  1. npm init -y
  2. npm install express express-graphql
  3. npm install graphql

try installing express-graphql before graphql it work`s

Solution 2:[2]

Can you try deleting your package-lock.json file may help as per the github issue

Solution 3:[3]

install express-graphql before installing express

Solution 4:[4]

  1. Delete package.json, package.lock.json, & node modules.

  2. Initialize npm again

  3. Now, First download express-graphql from npm ( Download before any other npm package in app )

These steps solve my problem

Solution 5:[5]

npm install express-graphql --save --force

works 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 RST Entertainment
Solution 2 Sajeetharan
Solution 3 Amalesh
Solution 4 Hemant Soni
Solution 5 Karikaalan