Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 安装graphql工具和graphql express后。控制台中的错误消息';找不到名称';异步迭代器';_Node.js_Express_Graphql_Express Graphql_Async Iterator - Fatal编程技术网

Node.js 安装graphql工具和graphql express后。控制台中的错误消息';找不到名称';异步迭代器';

Node.js 安装graphql工具和graphql express后。控制台中的错误消息';找不到名称';异步迭代器';,node.js,express,graphql,express-graphql,async-iterator,Node.js,Express,Graphql,Express Graphql,Async Iterator,启动应用程序时的错误日志 "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",

启动应用程序时的错误日志

  "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"
  }
在启动应用程序时,它显示了以下错误,我尝试了下面提到的在线修复程序,但没有一个可以请求建议和解决方案

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'.
根据谷歌搜索结果尝试修复

  • esnext.asynciterable
    添加到
    tsconfig.json
  • esnext
    添加到
    tsconfig.json
  • 但没有一个成功。 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中添加以下内容

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

    我遇到了同样的问题并添加了

    "lib": ["es2017", "esnext", "esnext.asynciterable"]
    
    对我来说,tsconfig.json没有帮助,这令人沮丧


    我考虑了很多建议,最终希文德拉的答案为我解决了这个问题。希望这将有助于其他人在未来来到这里

    你能尝试升级TypeScript吗?我正在使用2.9.1,它适合我。如果这没有帮助,那么如果你也能在这里发布你的tsconfig.json文件,可能会帮助下一个响应者,那就太好了。你好,Shivendra Gupta,我已经安装了这些包,但它仍然返回相同的错误。删除节点模块,然后执行->npm安装添加了“编译器选项”:{“lib”:[“esnext.asynciterable”]在tsconfig.json?嘿,Shivendra Gupta中,我尝试了上述步骤,现在我得到以下错误node_modules/@types/graphql/subscription/subscription.d.ts(36,13):错误TS2304:找不到名称“AsyncIterator”。