在离子框架中需要模块时出现问题

时间:2018-10-03 14:08:59

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

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

const dialogflow = require('dialogflow');

在编译时会引发以下错误:

  

找不到名称“ require”。

我该如何解决?

1 个答案:

答案 0 :(得分:0)

将类型添加到tsconfig.json

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