keystone.getResolvers is not a function
See original GitHub issueNOTE: I notice there have been some changes in the last day to the Keystone repo, so perhaps when I reinstalled my node_modules
it grabbed the latest version and that is causing the problem?
I’m working on a KeystoneJS project. I added hooks to one of my lists and the project worked fine. When I was finished with my work I pushed my work to GitHub and made a pull request for my team. However GitHub complained about a security error (in yarn.lock), so I deleted yarn.lock, reinstalled node_modules(yarn). When I ran the project again locally, however, I received the following error:
✔ Validated project entry file ./tsout/index.js
✔ Keystone server listening on port 4545
✔ Initialised Keystone instance
✖ Connecting to database
TypeError: keystone.getResolvers is not a function
at createApolloServer (/Users/r/Documents/projects/yaa-keystone/node_modules/@keystonejs/app-graphql/lib/apolloServer.js:148:25)
at GraphQLApp.prepareMiddleware (/Users/r/Documents/projects/yaa-keystone/node_modules/@keystonejs/app-graphql/index.js:23:20)
at /Users/r/Documents/projects/yaa-keystone/node_modules/@keystonejs/keystone/lib/Keystone/index.js:752:17
at Array.map (<anonymous>)
at Keystone.prepare (/Users/r/Documents/projects/yaa-keystone/node_modules/@keystonejs/keystone/lib/Keystone/index.js:751:12)
at executeDefaultServer (/Users/r/Documents/projects/yaa-keystone/node_modules/@keystonejs/keystone/bin/utils.js:112:42)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
It’s throwing the error deep inside the keystone package in node_modules. I deleted and reinstalled node_modules, I reverted my project to a commit from yesterday that worked fine, but I keep getting the same error.
I went back to the already-working ’develop` branch and the same issue. It must be something inside node_modules?
Any help appreciated, as I’m dead in the water now.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
You’re correct; this was changed in a release that went out about 10hrs ago.
There’s a chance that the version of
@keystonejs/keystone
your project depends on is different to the version which@keystonejs/app-graphql
depends on. If that’s the case, then this error will occur.You could verify this with yarn:
Ideally, that would show only one version, but I suspect it will show you two versions.
By removing your
yarn.lock
, yarn has been instructed to fetch the latest versions of packages, and led to this issue. It’s generally a good idea to avoid removingyarn.lock
in its entirety for this and similar reasons. (Personally, I do still delete it sometimes as it’s the only way to get certain things to happen).Two possible solutions to your current problem:
Revert the changes in
yarn.lock
, remove yournode_modules
folder, and runyarn
again.package.json
, and remove any semver range specifiers, then re-runyarn
For example, make this change:This should lock down the versions
Preferred. Use ~
yarn outdated --latest
~yarn upgrade-interactive --latest
to update to the latest versions of all@keystonejs/*
packages.Really sorry about the headaches this has caused you!