启动KeystoneJS应用程序时GraphQL错误

问题描述 投票:1回答:1

我刚刚用以下方法创建了一个KeystoneJS yarn create keystone-app my-app.

当我尝试用 yarn dev 并浏览到它,我得到以下错误。

Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

https://yarnpkg.com/en/docs/selective-version-resolutions

Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
    at instanceOf (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/node_modules/graphql/jsutils/instanceOf.js:28:13)
    at isSchema (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/node_modules/graphql/type/schema.js:36:34)
    at assertSchema (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/node_modules/graphql/type/schema.js:40:8)
    at validateSchema (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/node_modules/graphql/type/validate.js:44:28)
    at graphqlImpl (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/node_modules/graphql/graphql.js:79:62)
    at /my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/node_modules/graphql/graphql.js:28:59
    at new Promise (<anonymous>)
    at graphql (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/node_modules/graphql/graphql.js:26:10)
    at _graphQLQuery.<computed> (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/lib/Keystone/index.js:477:7)
    at Keystone.executeQuery (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/lib/Keystone/index.js:252:14)
    at Object.module.exports [as onConnect] (/my/home/path/my-first-ks-app/initial-data.js:10:22)
    at /my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/lib/Keystone/index.js:323:35
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async executeDefaultServer (/my/home/path/my-first-ks-app/node_modules/@keystonejs/keystone/bin/utils.js:114:3)
error Command failed with exit code 1.

我在Windows 10 WSL(v1)和Ubuntu上。KeystoneJS从Linux运行,MongoDB服务器安装并在Windows上运行。这是因为当我让它在Linux中运行时。mongod 显示为正在运行和监听,但我无法连接到它(通过KeystoneJS或通过shell用 mongo 命令)。)

如何解决这个问题?

mongodb graphql yarnpkg windows-subsystem-for-linux keystonejs
1个回答
1
投票

我使用的是 [email protected] 当我得到这个错误的时候。

我把它降级为 [email protected].

我在一个使用apollo的keystone项目中遇到了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.