安装graphql-tools和graphql-express之后.控制台“找不到名称" AsyncIterator"中的错误消息 [英] After installing graphql-tools and graphql-express. Error message in console 'Cannot find name 'AsyncIterator'

查看:192
本文介绍了安装graphql-tools和graphql-express之后.控制台“找不到名称" AsyncIterator"中的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误登录启动应用程序

在启动应用程序时,它显示以下错误,我尝试从网上进行了一些修复,这些修复已在下​​面提到,但是它们都没有工作,无法寻求建议和解决方案

While initiating the application it shows the following error and i tried couple of fixes from online which has mentioned below but none of them has worked requesting for suggestions and solutions

node_modules/@types/graphql/subscription/subscribe.d.ts(17,12): error TS2304: Cannot find name 'AsyncIterator'.
node_modules/@types/graphql/subscription/subscribe.d.ts(29,12): error TS2304: Cannot find name 'AsyncIterable'.
node_modules/graphql-tools/dist/stitching/makeRemoteExecutableSchema.d.ts(3,109): error TS2304: Cannot find name 'AsyncIterator'.

根据Google搜索结果进行的尝试

  1. esnext.asynciterable添加到tsconfig.json
  2. esnext添加到tsconfig.json
  1. Adding esnext.asynciterable to the tsconfig.json
  2. Adding esnext to the tsconfig.json

但是它们都没有起作用. package.json

But none of them has worked. package.json

  "dependencies": {
    "async": "^2.6.0",
    "body-parser": "^1.18.2",
    "cookie-parser": "^1.4.3",
    "cors": "^2.8.4",
    "ejs": "^2.5.7",
    "errorhandler": "^1.5.0",
    "express": "^4.16.2",
    "express-graphql": "^0.6.12",
    "graphql": "^0.13.2",
    "graphql-tools": "^3.1.1",
    "ldapjs": "^1.0.1",
    "method-override": "^2.3.10",
    "moment": "^2.20.1",
    "mongoose": "^4.13.6",
    "morgan": "^1.9.0",
    "mysql": "^2.15.0",
    "node-schedule": "^1.3.0",
    "nodemiral": "^1.1.1",
    "pug": "^2.0.0-rc.4",
    "q": "^1.5.1",
    "request": "^2.85.0",
    "sendmail": "^1.2.0",
    "serve-favicon": "^2.4.5",
    "socket.io": "^2.0.4",
    "ts-node": "^3.3.0"
  },
  "devDependencies": {
    "@types/async": "^2.0.47",
    "@types/body-parser": "^1.16.8",
    "@types/chai": "^4.0.8",
    "@types/chai-http": "^3.0.3",
    "@types/cookie-parser": "^1.4.1",
    "@types/cors": "^2.8.3",
    "@types/errorhandler": "0.0.32",
    "@types/ldapjs": "^1.0.3",
    "@types/lodash": "^4.14.106",
    "@types/method-override": "0.0.31",
    "@types/mocha": "^2.2.44",
    "@types/mongodb": "^2.2.16",
    "@types/mongoose": "^4.7.28",
    "@types/morgan": "^1.7.35",
    "@types/mysql": "^2.15.3",
    "@types/node-schedule": "^1.2.2",
    "@types/request": "^2.47.0",
    "@types/serve-favicon": "^2.2.30",
    "@types/socket.io": "^1.4.32",
    "chai": "^4.1.2",
    "chai-http": "^3.0.0",
    "grunt": "^1.0.1",
    "grunt-concurrent": "^2.3.1",
    "grunt-contrib-copy": "^1.0.0",
    "grunt-contrib-watch": "^1.0.0",
    "grunt-mocha-test": "^0.13.3",
    "grunt-newer": "^1.3.0",
    "grunt-nodemon": "^0.4.2",
    "grunt-ts": "^6.0.0-beta.17",
    "grunt-tslint": "^5.0.1",
    "grunt-typedoc": "^0.2.4",
    "mocha": "^4.0.1",
    "mocha-typescript": "^1.1.12",
    "nodemon": "^1.12.4",
    "tslint": "^5.8.0",
    "typescript": "^2.6.2"
  }

推荐答案

然后删除节点模块:-

npm install 
npm install --save graphql-subscriptions
npm install --save @types/graphql
npm install --save @types/ws

在tsconfig.json中添加以下内容

add the following in tsconfig.json

"compilerOptions": {
  "lib": [
     "esnext.asynciterable"
   ]

这篇关于安装graphql-tools和graphql-express之后.控制台“找不到名称" AsyncIterator"中的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆