altsam / create_an_airdrop_program

1 stars 12 forks source link

ReferenceError: TextEncoder is not defined #6

Open rapidgithub opened 2 years ago

rapidgithub commented 2 years ago

Does not work with nodejs 10.x

ReferenceError: TextEncoder is not defined
    at Function.fromSecretKey (/home/web3js/node_modules/@solana/web3.js/lib/index.cjs.js:7320:23)
    at getWalletBalance (/home/web3js/index.js:26:31)
    at driverFunction (/home/web3js/index.js:55:11)
    at Object.<anonymous> (/home/web3js/index.js:59: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 Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

Need to add below in index.js global.TextEncoder = require("util").TextEncoder;

Tushar7-pixel commented 2 years ago

i am Having Same Issue...! Did you find any alternate solution yet??

yaseenammaar commented 2 years ago

Same Issue here, any fix?

Tushar7-pixel commented 2 years ago

Same Issue here, any fix?

Yes, I have installed WSL command-line interface and it worked...! but i had to install nodeJS, rust and solana again in this cli..! which was frustrating...! "Best of Luck"