Baileys: [BUG] TypeScript error - Cannot find module '@adiwajshing/baileys' or its corresponding type declarations.
Describe the bug
On the import line it gives me an error - Cannot find module '@adiwajshing/baileys' or its corresponding type declarations.
import makeWASocket, {DisconnectReason, makeInMemoryStore, isJidGroup, useMultiFileAuthState} from '@adiwajshing/baileys'
The same line worked fine with the previous repo, adiwajshing/baileys
To Reproduce Steps to reproduce the behavior:
- Install the library as dependency in TS project -
yarn add github:WhiskeySockets/Baileys
- Run
npm run build
(I’m usingnest
for that) - Observe the error.
Expected behavior It works 😃
Environment (please complete the following information):
- node 18
- yarn 1.22
- typescript 4.7.4
- What else could help here?
Additional context
The same code with adiwajshing/baileys
dependency from node_modules
works fine. No changes made.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (5 by maintainers)
Use “@adiwajshing/baileys”: “github: WhiskeySockets/Baileys”,
Now you can install using
npm install @whiskeysockets/baileys
oryarn add @whiskeysockets/baileys
- https://whiskeysockets.github.io/docs/introYou can use the git version using NPM or Yarn V2, the Yarn v1 (classic) will not work.
OK, do the following.
1- delete the node modules
2- delete the package.lock
3- run -> yarn install.
4 - verify https ->“@adiwajshing/baileys”: https://github.com/WhiskeySockets/Baileys
5- clear npm cache
I had the same error, when I did that it started working again and recognizing normally
uses npm, using yarn you need to run tsc manually.
If I suppress it with
// @ts-ignore
it shows