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:
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'typegram/callback'
Require stack:
- C:\gitprojects\bot\node_modules\telegraf\lib\telegram-types.js
- C:\gitprojects\bot\node_modules\telegraf\lib\context.js
- C:\gitprojects\bot\node_modules\telegraf\lib\composer.js
- C:\gitprojects\bot\node_modules\telegraf\lib\telegraf.js
- C:\gitprojects\bot\node_modules\telegraf\lib\index.js
- C:\gitprojects\bot\index.js
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:690:27)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:852:19)←[39m
←[90m at require (internal/modules/cjs/helpers.js:74:18)←[39m
at Object.<anonymous> (C:\gitprojects\bot\node_modules\←[4mtelegraf←[24m\lib\telegram-types.js:16:14)
←[90m at Module._compile (internal/modules/cjs/loader.js:959:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:815:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:727:14)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:852:19)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\gitprojects\\bot\\node_modules\\telegraf\\lib\\telegram-types.js'←[39m,
←[32m'C:\\gitprojects\\bot\\node_modules\\telegraf\\lib\\context.js'←[39m,
←[32m'C:\\gitprojects\\bot\\node_modules\\telegraf\\lib\\composer.js'←[39m,
←[32m'C:\\gitprojects\\bot\\node_modules\\telegraf\\lib\\telegraf.js'←[39m,
←[32m'C:\\gitprojects\\bot\\node_modules\\telegraf\\lib\\index.js'←[39m,
←[32m'C:\\gitprojects\\bot\\index.js'←[39m
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
'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:
const { Telegraf } = require('telegraf');
Any tips?
Solved by downgrading to 4.1.0 version of the package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With