I did a discord bot in nodejs when I try to turn it on I have an error: Cannot use import statement outside a module

Cannot use import statement outside a module

my code:
import { client as _client } from ‘discord.js’;
const Discord = require(‘discord.js’); const client = new Discord.client();

client.on(‘ready’, () => {
console.log(‘Logged in as $(client.user.tag)!’);
});

client.on( “message”, msg => {
if (sg.content === ‘ping’){
msg.reply(‘Pong!’);
}
});

client.login(‘token. I can’t show it because bot’)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.