ReferenceError: TextDecoder is not defined

Hi all

Operating system: Linux
Truffle version: Version: 0.8.7+commit.e28d00a7.Linux.g++
Truffle-upgrades version: v1.9.0
truffle/hdwallet-provider version: 1.5.0
Truffle v5.4.3 (core: 5.4.3)
Solidity - 0.8.7 (solc-js)
Node v10.19.0
Web3.js v1.5.0
Network: mainnet

This error occurs in this file during migration:

// migrations/2_deploy_upgradeable.js
const { deployProxy } = require('@openzeppelin/truffle-upgrades');

const myTokenU = artifacts.require('MyToken');

module.exports = async function (deployer) {
  const instance = await deployProxy(myTokenU, ["MyToken", "MET", 100000000], { deployer, initializer: 'initialize' });
  console.log('Deployed', instance.address);

The error:


const td = new TextDecoder('utf8', {fatal: true, ignoreBOM: true})

ReferenceError: TextDecoder is not defined

How to fix this? Thank you very much.

Best regards,

Please try removing node_modules and reinstalling dependencies. This looks like an error in your setup.