M
M
Mark Eshkilev2020-08-04 13:36:09
Node.js
Mark Eshkilev, 2020-08-04 13:36:09

It gives an error when starting the VK bot, what should I do?

Hello ... I'm starting to write my own bot for VK, I wrote the initial code

const express = require('express');
const bodyParser = require('body-parser');
const VkBot = require('node-vk-bot-api');

const app = express();
const bot = new VkBot({
  token: 'секрет',
  confirmation: 'секрет'
});

bot.on((ctx) => {
  ctx.reply('Hello!');
});

app.use(bodyParser.json());

app.post('/', bot.webhookCallback);

app.listen(80);

opened the port using ngrok
trying to run node.js with the node bot.js command
in response to the terminal an error is generated
PS C:\Users\Марк Ешкилев\Desktop\bot vk2> node bot.js
internal/modules/cjs/loader.js:969
  throw err;


Error: Cannot find module 'express'
Require stack:
- C:\Users\Марк Ешкилев\Desktop\bot vk2\bot.js
←[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:842:27)←[39m
←[90m    at Module.require (internal/modules/cjs/loader.js:1026:19)←[39m
←[90m    at require (internal/modules/cjs/helpers.js:72:18)←[39m
    at Object.<anonymous> (C:\Users\Марк Ешкилев\Desktop\bot vk2\bot.js:1:17)
←[90m    at Module._compile (internal/modules/cjs/loader.js:1138:30)←[39m
←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)←[39m
←[90m    at Module.load (internal/modules/cjs/loader.js:986:32)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:879:14)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: [ ←[32m'C:\\Users\\Марк Ешкилев\\Desktop\\bot vk2\\bot.js'←[39m ]
}

what to do...??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2020-08-04
@xmoonlight

Error: Cannot find module 'express'
Can't find module 'express'.
Apparently, you need to install it using npm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question