"Error: Cannot find module 'botbuilder'" when trying to use BotFramework
"Error: Cannot find module 'botbuilder'" when trying to use BotFramework
我已经使用 npm 下载 package.json 和 npm install 安装 botbuilder 和 api-ai-recognizer,但它告诉我找不到 botbuilder。有人可以帮助我吗?
我在我的 Azure Cloud Shell 中完成了以下操作:
mkdir weather-bot
cd weather-bot
npm init
npm install --save botbuilder api-ai-recognizer
cd ~
touch index.js
vi index.js
var builder = require('botbuilder');
var connector = new builder.ConsoleConnector().listen();
var bot = new builder.UniversalBot(connector);
bot.dialog('/',function(session){ session.send("You said %s", session.message.text); });
我启动节点服务器后
node index.js hi You said hi hello You said hello
我收到错误 "Error: Cannot find module 'botbuilder'"。
您似乎在 weather-bot(即 ~/weather-bot/node_modules)中安装了 npm 模块,但您已将 index.js 文件放在根目录(即 ~/index.js) .因此,当您尝试 运行 您的机器人时,它会在 ~/node_modules 中寻找 botbuilder
模块,但它没有安装在那里。尝试将您的 index.js 文件移动到您的 weather-bot 目录,看看它是否有效。
我已经使用 npm 下载 package.json 和 npm install 安装 botbuilder 和 api-ai-recognizer,但它告诉我找不到 botbuilder。有人可以帮助我吗?
我在我的 Azure Cloud Shell 中完成了以下操作:
mkdir weather-bot
cd weather-bot
npm init
npm install --save botbuilder api-ai-recognizer
cd ~
touch index.js
vi index.js
var builder = require('botbuilder');
var connector = new builder.ConsoleConnector().listen();
var bot = new builder.UniversalBot(connector);
bot.dialog('/',function(session){ session.send("You said %s", session.message.text); });
我启动节点服务器后
node index.js hi You said hi hello You said hello
我收到错误 "Error: Cannot find module 'botbuilder'"。
您似乎在 weather-bot(即 ~/weather-bot/node_modules)中安装了 npm 模块,但您已将 index.js 文件放在根目录(即 ~/index.js) .因此,当您尝试 运行 您的机器人时,它会在 ~/node_modules 中寻找 botbuilder
模块,但它没有安装在那里。尝试将您的 index.js 文件移动到您的 weather-bot 目录,看看它是否有效。