【问题标题】:Problem when requiring module in ionic framework [duplicate]在离子框架中需要模块时出现问题[重复]
【发布时间】:2019-03-08 19:05:25
【问题描述】:

在我的项目中(使用 ionic-framework 3)我使用了以下语句来要求 dialogflow 模块:

const dialogflow = require('dialogflow');

在编译时抛出以下错误:

找不到名称'require'。

我该如何解决这个问题?

【问题讨论】:

  • import * as dialogflow from 'dialogflow';?
  • 我没有导入那个。我的写法和你写的一样吗?

标签: node.js angular typescript ionic-framework ionic3


【解决方案1】:

向 tsconfig.json 添加类型

"types": [
    "node"
],
"typeRoots": [
    "node_modules/@types"
]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多