Bug Report
I have read:
I am using the latest version of the library.
Feature Request
I have:
Question
const TelegramBot = require('node-telegram-bot-api');
{ Error: Cannot find module 'node-telegram-bot-api'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18) code: 'MODULE_NOT_FOUND' }
Not sure how to troubleshoot this error.
Can you provide your code please?
EDIT: so you executed the classic npm install --save node-telegram-bot-api, right?
i executed that in the node.js command prompt with 2 warnings of:
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
followed by entering:
const TelegramBot = require('node-telegram-bot-api');
in the node.js application? because the node.js command prompt says that:
'const' is not recognized as an internal or external command, operable program or batch file.
That's really weird. What's your node and npm version? (node -v and npm version) Also, what's your platform?
The warnings are about your package.
Platform: Windows
node and npm version:
c: '1.0.0',
npm: '6.4.1',
ares: '1.14.0',
cldr: '33.1',
http_parser: '2.8.0',
icu: '62.1',
modules: '64',
napi: '3',
nghttp2: '1.34.0',
node: '10.14.1',
openssl: '1.1.0j',
tz: '2018e',
unicode: '11.0',
uv: '1.23.2',
v8: '6.8.275.32-node.36',
zlib: '1.2.11'
Wait, when you tried to execute const TelegramBot = require('node-telegram-bot-api');, did you enter in a node session? I mean, you started before node with node command or inserted it directly inside the terminal?
No, this is Node Terminal.
Look at this: https://stackoverflow.com/questions/9587665/nodejs-cannot-find-installed-module-on-windows
I'm at a lost at which terminal i should actually be using to write the codes.
No, you are right. I'm used to linux-like terminals, like WSL (bash on windows), that's why I asked. Don't worry 馃槉.
I was wrong in the last message. I meant "No, it doesn't count as this implies like you already started a node session. So you are right."
My knowledge of codding only extends to the very basic of C++ so everything feels complicated, even the simplest guide is hard for me to follow. Thought that i could learn to create telegram bot if i just followed the instructions, but looks like its hard if i don't have any background in this lol.
i read the link you showed me, all i'm getting is that the commands i'm giving is not a global one , so it is not able to search up the telegrambot file that i cloned for this. But i'm not sure how and where to type those "PATHS" into the appropriate file to reach the telegram bot module.
Well, to create a bot, you should at least understand the basics of HTTP requests to see how the communication between telegram bot API and your application work.
Usually, development is better under Linux or mac os, both with the terminal, because it is simpler, but it can be done also under windows, even if sometimes more complicated. For example, in the link I provided you, they gave you a procedure to make it work, but you should at least know how to get in there (and I don't know how to help you here).
You have to write those paths under windows Environmental
Variables, which are "global" variables valid for all the sessions. Look here: https://www.computerhope.com/issues/ch000549.htm
Ok! I'll just do that and try to fumble around with it until i'm totally stuck again.
Thanks alot for the help!
You are welcome! 馃槈