WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
3.63k stars 1.23k forks source link

[BUG] example.ts doesn't work if I follow instructions from README.md #153

Closed allburov closed 1 year ago

allburov commented 1 year ago

Describe the bug If you follow the guide for "example.ts" file - it doesn't work https://github.com/WhiskeySockets/Baileys#example

To Reproduce Do check out & run example.ts to see an example usage of the library. The script covers most common use cases. To run the example script, download or clone the repo and then type the following in a terminal:

It gives error:

allburov@allburov:~/git/WhiskeySockets-Baileys$ yarn example
yarn run v1.22.19
$ node --inspect -r ts-node/register Example/example.ts
Debugger listening on ws://127.0.0.1:9229/d16971b4-734a-46cb-8f7d-627054174eeb
For help, see: https://nodejs.org/en/docs/inspector
using WA v2.2325.3, isLatest: true
/home/allburov/git/WhiskeySockets-Baileys/src/Utils/auth-utils.js:53
    var cache = _cache || new node_cache_1["default"]({
                          ^
TypeError: node_cache_1.default is not a constructor
    at makeCacheableSignalKeyStore (/home/allburov/git/WhiskeySockets-Baileys/src/Utils/auth-utils.js:53:27)
    at startSock (/home/allburov/git/WhiskeySockets-Baileys/Example/example.ts:43:37)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior Everything works

Environment (please complete the following information):

Additional context

Probably some command has been missed in the README.md for the example.ts

allburov commented 1 year ago

It works after I removed all js files from src!

cd src
 rm -rvf */*.js