im working on a telegram bot using the telegraf
package. (version 4.1.1)
everything was working until i started using more modules from the telegraf package like Extra
and mark-up
.
I started getting this error:
JavaScript
x
36
36
1
internal/modules/cjs/loader.js:800
2
throw err;
3
^
4
Error: Cannot find module 'typegram/callback'
5
Require stack:
6
- C:gitprojectsbotnode_modulestelegraflibtelegram-types.js
7
- C:gitprojectsbotnode_modulestelegraflibcontext.js
8
- C:gitprojectsbotnode_modulestelegraflibcomposer.js
9
- C:gitprojectsbotnode_modulestelegraflibtelegraf.js
10
- C:gitprojectsbotnode_modulestelegraflibindex.js
11
- C:gitprojectsbotindex.js
12
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)←[39m
13
←[90m at Function.Module._load (internal/modules/cjs/loader.js:690:27)←[39m
14
←[90m at Module.require (internal/modules/cjs/loader.js:852:19)←[39m
15
←[90m at require (internal/modules/cjs/helpers.js:74:18)←[39m
16
at Object.<anonymous> (C:gitprojectsbotnode_modules←[4mtelegraf←[24mlibtelegram-types.js:16:14)
17
←[90m at Module._compile (internal/modules/cjs/loader.js:959:30)←[39m
18
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)←[39m
19
←[90m at Module.load (internal/modules/cjs/loader.js:815:32)←[39m
20
←[90m at Function.Module._load (internal/modules/cjs/loader.js:727:14)←[39m
21
←[90m at Module.require (internal/modules/cjs/loader.js:852:19)←[39m {
22
code: ←[32m'MODULE_NOT_FOUND'←[39m,
23
requireStack: [
24
←[32m'C:\gitprojects\bot\node_modules\telegraf\lib\telegram-types.js'←[39m,
25
←[32m'C:\gitprojects\bot\node_modules\telegraf\lib\context.js'←[39m,
26
←[32m'C:\gitprojects\bot\node_modules\telegraf\lib\composer.js'←[39m,
27
←[32m'C:\gitprojects\bot\node_modules\telegraf\lib\telegraf.js'←[39m,
28
←[32m'C:\gitprojects\bot\node_modules\telegraf\lib\index.js'←[39m,
29
←[32m'C:\gitprojects\bot\index.js'←[39m
30
]
31
}
32
npm ERR! code ELIFECYCLE
33
npm ERR! errno 1
34
npm ERR! bot@1.0.0 start: `node index.js`
35
npm ERR! Exit status 1
36
‘typegram/callback’ is installed but is a typescript file,i don’t have typescript installed but i didn’t have issues before the error.
I reverted to my latest working build but the error hasn’t changed..
right now this is the only line of code:
JavaScript
1
2
1
const { Telegraf } = require('telegraf');
2
Any tips?
Advertisement
Answer
Solved by downgrading to 4.1.0 version of the package.