Cannot find module 'graphql/validation/rules/PossibleTypeExtensions'

Viewed 3419

I'm in the process of learning about the MERN stack by following this book https://www.amazon.com/Pro-MERN-Stack-Development-Express-dp-1484243900/dp/1484243900/ref=mt_paperback?_encoding=UTF8&me=&qid= but even if it is a very recent one (published in 2019) the code examples are a travesty.

Basically when I try to start the server contained in this repo https://github.com/vasansr/pro-mern-stack-2/tree/05.02-graphql-schema-file with the command npm start the app crashes and it returns an

Error: Cannot find module 'graphql/validation/rules/PossibleTypeExtensions'

The code in the repo was published directly by the author so I don't exactly know how to solve this, could someone help me? Thanks a lot.

3 Answers

I am following the same tutorial and it seems to work if you upgrade the graphgql to 14.6.0

Upgrade your versionnpm i graphql@latest

reinstal using yarn add graphql and update the dependencies as below

"dependencies": {
    "apollo-server": "^2.13.1",
    "apollo-server-express": "^2.13.1",
    "express": "^4.17.1",
    "graphql": "^15.0.0",
    "nodemon": "^1.19.4"
  },
Related