Table of Contents

, , ,

node troubleshooting

globalThis is not defined

Error when trying to run soketi on Ubuntu 20.04 server:

/usr/local/lib/node_modules/@soketi/soketi/node_modules/nats/lib/src/mod.js:37
if (typeof globalThis.crypto === "undefined") {
^

ReferenceError: globalThis is not defined
    at Object.<anonymous> (/usr/local/lib/node_modules/@soketi/soketi/node_modules/nats/lib/src/mod.js:37:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@soketi/soketi/node_modules/nats/index.js:17:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)

Node.js is probably outdated. Try using newer version, for example download nvm and install newer node version:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install v14.21.3

Tested on

See also

References