9
I’m 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.
2
14 Answers
Reset to default
15
Delete the full initialized project then run the following:
npm init -y
npm install express express-graphql
npm install graphql
You should install express-graphql
before graphql
.
6
Uninstall graphql
module if it’s present. Then install both of them with one command:
npm install graphql express-graphql
3
I generated my app using:
npx express-generator <projectName>
and to solve the issue, I just did:
npm un express graphql
which where modules that I had already installed and then ran:
npm i express-graphql graphql express
in that order worked for me.
2
- Delete
package.json
,package-lock.json
, &node_modules
. - Initialize
npm
again. - Now, install
express-graphql
withnpm
at first (install before any other package in the app).
These steps solve my problem.
1
If you try to install express-graphql
after graphql
, it creates the conflict and that errors you see in the console.
According to GraphQL spec, you should use the following modules installation order:
npm install express express-graphql graphql --save
To fix the issues, you should:
- Remove
graphql
- Install
express-graphql
- Install
graphql
0
STEP 1: Delete package.json
, package-lock.json
, node_modules
and start again.
STEP 2: npm install express express-graphql graphql --save
Apparently installing packages in that order works. Command is copied from GraphQL
docs.
https://graphql.org/graphql-js/running-an-express-graphql-server/
0
Install express-graphql
before installing express
.
1
-
? The OP just failed to install express-graphql, so how he will install before something else ?
– Elikill58Mar 8, 2022 at 9:06
0
I deleted package-lock.json
and ran
npm install express-graphql graphql --save
It worked for me.
0
As stated in the other answers, first remove graphql
via:
npm remove graphql
Now install express-graphql
with this command:
npm install express-graphql
It works for me.
0
install express-graphql
with yarn
- install yarn
npm install --global yarn
- install dependencie
yarn add express-graphql
be happy!
Not the answer you're looking for? Browse other questions tagged
or ask your own question.
or ask your own question.
Same error. Did you find a solution?
Feb 19, 2022 at 21:46
I am facing a similar problem.
Apr 10 at 5:25
|