Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passed Getting Started › Quick start and got TypeError: keystone.createApolloServer is not a function #3349

Closed
vladignatyev opened this issue Aug 5, 2020 · 10 comments

Comments

@vladignatyev
Copy link

vladignatyev commented Aug 5, 2020

Bug report

Describe the bug

Getting started for Keystone 5 ends up in errors, not in fun coding experience!!!

To Reproduce

Steps to reproduce the behaviour. Please provide code snippets or a repository:

  1. Go to https://www.keystonejs.com/quick-start/
  2. And try to pass the guide, use PostgreSQL as a database.

System information

  • OS: macOS
  • node v12.11.0
  • npm 6.11.3
  • yarn 1.22.4

Additional context

{
  "name": "@keystonejs/example-projects-todo",
  "description": "An example KeystoneJS project showcasing a simple Todo List with a Keystone StaticApp front-end.",
  "private": true,
  "version": "5.0.12",
  "author": "The KeystoneJS Development Team",
  "repository": "https://github.com/keystonejs/keystone/tree/master/packages/create-keystone-app/example-projects/todo",
  "homepage": "https://github.com/keystonejs/keystone",
  "license": "MIT",
  "engines": {
    "node": ">=10.0.0"
  },
  "scripts": {
    "dev": "cross-env NODE_ENV=development DISABLE_LOGGING=true keystone dev",
    "build": "cross-env NODE_ENV=production keystone build",
    "start": "cross-env NODE_ENV=production keystone start",
    "create-tables": "cross-env keystone create-tables"
  },
  "dependencies": {
    "@keystonejs/adapter-knex": "^11.0.1",
    "@keystonejs/app-admin-ui": "^7.1.0",
    "@keystonejs/app-graphql": "^6.0.0",
    "@keystonejs/app-static": "^5.1.2",
    "@keystonejs/fields": "^14.0.0",
    "@keystonejs/keystone": "^12.0.0",
    "cross-env": "^7.0.0"
  }
}

Log output:

$ yarn dev
yarn run v1.22.4
$ cross-env NODE_ENV=development DISABLE_LOGGING=true keystone dev
ℹ Command: keystone dev
✔ Validated project entry file ./index.js
✔ Keystone server listening on port 3000
No cookieSecret value was provided. Please generate a secure value and add it to your app. Until this is done, a random cookieSecret will be generated each time Keystone is started. This will cause sessions to be reset between restarts. See [https://www.keystonejs.com/keystonejs/keystone/#cookiesecret] for details.
✔ Initialised Keystone instance
✖ Initialising Keystone instance
TypeError: keystone.createApolloServer is not a function
    at GraphQLApp.prepareMiddleware (/Users/ignatev/Projects/mobile-cms-js/mobile-cms/node_modules/@keystonejs/app-graphql/index.js:28:29)
    at /Users/ignatev/Projects/mobile-cms-js/mobile-cms/node_modules/@keystonejs/keystone/lib/Keystone/index.js:609:17
    at Array.map (<anonymous>)
    at Keystone._prepareMiddlewares (/Users/ignatev/Projects/mobile-cms-js/mobile-cms/node_modules/@keystonejs/keystone/lib/Keystone/index.js:608:12)
    at Keystone.prepare (/Users/ignatev/Projects/mobile-cms-js/mobile-cms/node_modules/@keystonejs/keystone/lib/Keystone/index.js:626:36)
    at executeDefaultServer (/Users/ignatev/Projects/mobile-cms-js/mobile-cms/node_modules/@keystonejs/keystone/bin/utils.js:149:42)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Thank you for any help resolving this issue!

@vladignatyev
Copy link
Author

yarn.lock.zip

@vladignatyev
Copy link
Author

If your setup works, please share package.json and any additional info! Many thanks!

@MadeByMike
Copy link
Contributor

Hi @vladignatyev it's likely the CLI is caching one of dependencies. A method in @keystonejs/app-graphql was moved to @keystonejs/keystone both packages had major version bumps, but if somehow @keystonejs/app-graphql is updated without updating the core package as well - you will see this error.

We think this is happening with create-keystone-app at the moment. We're working on a fix to the CLI so this can't happen again but in the mean time please try updating all keystone dependencies with Yarn or NPM.

@amirmamaghani
Copy link

amirmamaghani commented Aug 6, 2020

npm install --save @keystonejs/keystone^13.0.0 solves the issue

@vladignatyev
Copy link
Author

vladignatyev commented Aug 6, 2020 via email

@amirmamaghani
Copy link

update package.json with this:

{
  "name": "@keystonejs/example-projects-starter",
  "description": "An example KeystoneJS project with a User list and Authentication.",
  "private": true,
  "version": "5.0.12",
  "author": "The KeystoneJS Development Team",
  "repository": "https://github.com/keystonejs/keystone/tree/master/packages/create-keystone-app/example-projects/starter",
  "homepage": "https://github.com/keystonejs/keystone",
  "license": "MIT",
  "engines": {
    "node": ">=10.0.0"
  },
  "scripts": {
    "dev": "cross-env NODE_ENV=development DISABLE_LOGGING=true keystone dev",
    "build": "cross-env NODE_ENV=production keystone build",
    "start": "cross-env NODE_ENV=production keystone start",
    "create-tables": "cross-env CREATE_TABLES=true keystone create-tables"
  },
  "dependencies": {
    "@keystonejs/adapter-mongoose": "^9.0.0",
    "@keystonejs/app-admin-ui": "^7.1.0",
    "@keystonejs/app-graphql": "^6.0.0",
    "@keystonejs/auth-password": "^5.1.11",
    "@keystonejs/fields": "^14.0.0",
    "@keystonejs/keystone": "^13.0.0",
    "cross-env": "^7.0.0"
  }
}

and should work

@MrSaikatS
Copy link

MrSaikatS commented Aug 7, 2020

Hello, this fixed this issue for me. Hope this will help you. Go and update package.json and change the keystone version from 12.0.0 to 13.0.0 as this image
image

@stale
Copy link

stale bot commented Dec 5, 2020

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

@stale stale bot added the needs-review label Dec 5, 2020
@vladignatyev
Copy link
Author

vladignatyev commented Dec 5, 2020 via email

@stale stale bot removed the needs-review label Dec 5, 2020
@bladey
Copy link
Contributor

bladey commented Apr 8, 2021

Keystone 5 has officially moved into active maintenance mode as we push towards the next major new version Keystone Next, you can find out more information about this transition here.

In an effort to sustain the project going forward, we're cleaning up and closing old issues such as this one. If you feel this issue is still relevant for Keystone Next, please let us know.

@bladey bladey closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants