TypeError: fields.flat is not a function

Hi, I am working on a bot named Cerberus, everything in my code has been debugged properly, and I just transferred from another site, I installed my packages and got everything ready, however, there was an issue inside the discord.js package, something to do with embeds, and I reinstalled discord.js, and still can’t seem to find the issue. The error shows as:

(node:18556) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
    at Function.normalizeFields (/rbd/pnpm-volume/4b03c829-133e-4371-90c4-5803671010c1/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/structures/MessageEmbed.js:450:8)
    at MessageEmbed.setup (/rbd/pnpm-volume/4b03c829-133e-4371-90c4-5803671010c1/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/structures/MessageEmbed.js:78:91)
    at new MessageEmbed (/rbd/pnpm-volume/4b03c829-133e-4371-90c4-5803671010c1/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/structures/MessageEmbed.js:18:10)
    at embedLikes.map.e (/rbd/pnpm-volume/4b03c829-133e-4371-90c4-5803671010c1/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/structures/APIMessage.js:166:40)
    at Array.map (<anonymous>)
    at APIMessage.resolveData (/rbd/pnpm-volume/4b03c829-133e-4371-90c4-5803671010c1/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/structures/APIMessage.js:166:31)
    at TextChannel.send (/rbd/pnpm-volume/4b03c829-133e-4371-90c4-5803671010c1/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62)
    at Object.execute (/app/commands/ping.js:11:32)
    at Client.client.on.message (/app/index.js:34:17)
    at Client.emit (events.js:189:13)
(node:18556) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18556) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Can you try upgrading Discord.js to v12?

Can you try changing:

"engines": {
     "node": "something"
}

to

"engines": {
     "node": "12.0.0"
}

because this usually happens if you are using a version of node less than 12.

You should probably set it to "node": "^12.0.0" or "node": "12.x" so if new security changes come out they’ll install.