[英]unable to install express-graphql
我正在尝试安装 express-graphql 但出现此错误。请帮忙
npm install --save express-graphql
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: rest-api@1.0.0
npm ERR! Found: graphql@16.2.0
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 express-graphql@0.12.0
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.
然后删除完整的初始化项目
npm init -y
npm install express express-graphql
npm install graphql
尝试在 graphql 之前安装 express-graphql 它可以工作
删除 package.json、package.lock.Z466DEEC76ECDF5FCA6D38571F6324 模块。
再次初始化 npm
现在,首先从 npm 下载 express-graphql(在应用程序中的任何其他 npm package 之前下载)
这些步骤解决了我的问题
我使用以下方法生成了我的应用程序:
npx express-generator <projectName>
为了解决这个问题,我只是做了:
npm un express graphql
我已经安装然后运行的模块在哪里:
npm i express-graphql graphql express
按这个顺序为我工作。
根据github 问题,您可以尝试删除您的package-lock.json文件吗?
在安装 express 之前安装 express-graphql
npm install express-graphql --save --force
为我工作。
我删除了 package-lock.json 并运行:
npm install express-graphql graphql --save
它对我有用
如果 graphql 模块存在,请卸载它。 然后使用一个命令安装它们:
npm install graphql express-graphql
像其他答案一样,首先通过删除 graphql
npm remove graphql
现在将 express-graphql 安装为
npm install express-graphql
这个对我有用。
我安装了graphql
然后express-graphql
,然后是npm i express --force
按照这些顺序安装 npm 安装 express-graphql graphql express
如果您尝试在 graphql 之后安装 express-graphql - 它会创建冲突并且您会在控制台中看到错误。 根据 graphql 规范,您应该使用下一个安装模块顺序,如下命令所示:
npm install express express-graphql graphql --save
要修复问题提到的错误,您应该:
第 1 步:删除 package.json、package-lock.json、node_modules 并重新开始。
第 2 步:npm 安装 express express-graphql graphql --save
显然按该顺序安装软件包是可行的。 命令复制自 GraphQL 文档。 https://graphql.org/graphql-js/running-an-express-graphql-server/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.