BotBuilder TypeError:builder.ConsoleConnector不是构造函数 [英] BotBuilder TypeError: builder.ConsoleConnector is not a constructor

查看:95
本文介绍了BotBuilder TypeError:builder.ConsoleConnector不是构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注NodeB的Microsoft Bot Builder(SDK v3)的官方快速入门: 使用Bot Builder SDK for Node.js创建机器人

I'm following the official quick start of Microsoft Bot Builder(SDK v3) for NodeJs: Create a bot with the Bot Builder SDK for Node.js

1-我用

npm初始化

npm init

2-然后

npm install-保存botbuilder

npm install --save botbuilder

3-然后我创建了一个新文件"app.js"

3- then I created a new file "app.js"

var builder = require('botbuilder');

var connector = new builder.ConsoleConnector().listen();
var bot = new builder.UniversalBot(connector, function (session) {
session.send("You said: %s", session.message.text);
});

但是当我运行"node app.js"时,会引发以下错误:

But when I run "node app.js" the following error is thrown:

var connector = new builder.ConsoleConnector().listen();
            ^

TypeError: builder.ConsoleConnector is not a constructor

请问有人可以帮我吗?

我的项目结构:

推荐答案

文档与最新版本的 botbuilder 软件包(版本4.0.6)功能/方法不匹配.微软已经更改了 botbuilder npm软件包的某些旧功能,但是它们尚未更新文档!

There is a mismatch between the documentation and the latest release of the botbuilder package (version 4.0.6) features / methods. Microsoft has changed some of the legacy features of the botbuilder npm package, but they haven't updated their doc yet!

The JavaScript code which is present in Microsoft's Documentation won't work for the same reason!

尝试使用botbuilder软件包3.13.1版,它将完美运行.

Try with the botbuilder package version 3.13.1 , it will work perfectly.

要安装:

npm i -S botbuilder@3.13.1

您的代码将起作用!

查找快照:

干杯!

这篇关于BotBuilder TypeError:builder.ConsoleConnector不是构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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