I am running into ReferenceError errors when trying to use the @streamerbot/client inside of a simple Node app. Specifically, WebSockets, and sometimes Crypto, can't be found. Hopefully I'm just missing something simple.
The Code
This is the entirety of the code I am trying.
import { StreamerbotClient } from '@streamerbot/client';
const sbClient = new StreamerbotClient();
const myActions = await sbClient.getActions();
The Error
When running it, I get the following error:
file:///sb-client/node_modules/@streamerbot/client/dist/index.js:154
return `sb:client:req:${Date.now()}-${crypto.getRandomValues(new Uint32Array(12))[0]}`;
^
ReferenceError: crypto is not defined
at generateRequestId (file:///sb-client/node_modules/←[4m@streamerbot←[24m/client/dist/index.js:154:41)
at StreamerbotClient.<anonymous> (file:///sb-client/node_modules/←[4m@streamerbot←[24m/client/dist/index.js:336:14)
at Generator.next (<anonymous>)
at file:///sb-client/node_modules/←[4m@streamerbot←[24m/client/dist/index.js:37:61
at new Promise (<anonymous>)
at __async (file:///sb-client/node_modules/←[4m@streamerbot←[24m/client/dist/index.js:21:10)
at StreamerbotClient.request (file:///sb-client/node_modules/←[4m@streamerbot←[24m/client/dist/index.js:334:12)
at StreamerbotClient.<anonymous> (file:///sb-client/node_modules/←[4m@streamerbot←[24m/client/dist/index.js:487:25)
at Generator.next (<anonymous>)
at file:///sb-client/node_modules/←[4m@streamerbot←[24m/client/dist/index.js:37:61
I also ran multiple iterations of npm install to try and make sure things were installed
npm install
npm install @streamerbot/client
npm install crypto
npm install ws
Thank you in advance! Again, hopefully it's something simple I'm missing.
I am running into ReferenceError errors when trying to use the
@streamerbot/client
inside of a simple Node app. Specifically, WebSockets, and sometimes Crypto, can't be found. Hopefully I'm just missing something simple.The Code
This is the entirety of the code I am trying.
The Error
When running it, I get the following error:
I also ran multiple iterations of
npm install
to try and make sure things were installednpm install
npm install @streamerbot/client
npm install crypto
npm install ws
Thank you in advance! Again, hopefully it's something simple I'm missing.