【问题标题】:All declarations of 'stream' must have identical modifiers api-ai-javascript - Dialogflow“流”的所有声明必须具有相同的修饰符 api-ai-javascript - Dialogflow
【发布时间】:2019-04-25 05:31:20
【问题描述】:

我正在尝试将 Dialogflow 集成到 Angular 7 中。我收到此错误。

  ** Angular Live Development Server is listening on localhost:4200, 
open your browser on http://localhost:4200/ **

Date: 2018-11-22T13:47:11.748Z
Hash: 4075ca64830b90f82558
Time: 4597ms
chunk {main} main.js, main.js.map (main) 1.85 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 92.4 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.2 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 318 kB [initial] [rendered]

ERROR in node_modules/api-ai-javascript/declarations.d.ts(39,5): error TS2687: All declarations of 'stream' must have identical modifiers.

ℹ 「wdm」: Failed to compile.

【问题讨论】:

    标签: angular dialogflow-es angular7


    【解决方案1】:

    我遇到了同样的错误,只是在导入行中进行了以下更改,它已修复。

    import {ApiAiClient} from 'api-ai-javascript/es6/ApiAiClient';
    

    【讨论】:

      【解决方案2】:

      我想我一直在学习相同的教程,我在 this thread right here. 中遇到了解决方案

      你正忙于导入库的部分应该有这个路径

      import { ApiAiClient } from 'api-ai-javascript/es6/ApiAiClient'
      

      在您的 tsconfig.json 中

      {
       "compileOnSave": false,
       "compilerOptions": {
         ...
         "baseUrl":"./",
         "typeRoots": ["node_modules/@types"],
         "lib": ["es2017", "dom"],
         "paths":{
            "api-ai-javascript/*":["node_modules/api-ai-javascript/es6/*]
         }
       }
      }
      

      希望这会有所帮助,这确实消除了编译错误并且我能够继续。

      source

      【讨论】:

      • 我设法让它工作,而无需修改我的 tsconfig 文件,只需更改导入 :) 感谢您的帮助。
      【解决方案3】:

      为了临时解决这个问题,我在您的 tsconfig.json 文件中添加了以下检查

        "compilerOptions": {
          "skipLibCheck": true
        }
      

      【讨论】:

      • 我无法继续使用此解决方案。
      猜你喜欢
      • 2021-05-29
      • 1970-01-01
      • 2018-11-11
      • 2017-08-13
      • 2023-03-21
      • 2017-11-15
      • 2018-04-18
      • 1970-01-01
      • 2017-07-14
      相关资源
      最近更新 更多