I have problem with discord.js script, my script copied directly from discordjs guide
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
client.login(token);
config.json file contains section token with my token.
Trying to run the script returns an error ReferenceError: ReadableStream is not defined
/home/ubuntu/discord/test-bot/node_modules/undici/lib/web/fetch/response.js:530
ReadableStream
^
ReferenceError: ReadableStream is not defined
at Object.<anonymous> (/home/ubuntu/discord/test-bot/node_modules/undici/lib/web/fetch/response.js:53 0:3)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/ubuntu/discord/test-bot/node_modules/undici/lib/web/fetch/index.js:11:5)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
Currently I use Discord.js v14.15.2 and node 16.11.0, but I tested the script with node 16.20.2 and newest LTS (20.14.0)
Does someone meet the problem?