'yarn run error : Command failed with exit code 1

I was trying to follow this tutorial
This is a tutorial on Solana program dev using anchor and the error rises from using yarn on ubuntu 20.0 i guess and I got this long error I can't understand All the help is appreciated

yarn run v1.22.17
warning package.json: No license field
$ /home/sadaf/code/solana-twitter/node_modules/.bin/ts-mocha -p ./tsconfig.json -t 1000000 'tests/**/*.ts'

ReferenceError: TextEncoder is not defined
    at Function.fromSecretKey (/home/sadaf/code/solana-twitter/node_modules/@solana/web3.js/src/keypair.ts:66:23)
    at Function.local (/home/sadaf/code/solana-twitter/node_modules/@project-serum/anchor/src/nodewallet.ts:13:27)
    at Function.env (/home/sadaf/code/solana-twitter/node_modules/@project-serum/anchor/src/provider.ts:79:31)
    at Suite.describe (/home/sadaf/code/solana-twitter/tests/solana-twitter.ts:7:38)
    at Object.create (/home/sadaf/code/solana-twitter/node_modules/mocha/lib/interfaces/common.js:148:19)
    at context.describe.context.context (/home/sadaf/code/solana-twitter/node_modules/mocha/lib/interfaces/bdd.js:42:27)
    at Object.<anonymous> (/home/sadaf/code/solana-twitter/tests/solana-twitter.ts:5:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Module.m._compile (/home/sadaf/code/solana-twitter/node_modules/ts-node/src/index.ts:439:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/home/sadaf/code/solana-twitter/node_modules/ts-node/src/index.ts:442:12)
    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 Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.implementationOfRequireOrImportForUnstableEsm [as requireOrImport] (/home/sadaf/code/solana-twitter/node_modules/mocha/lib/nodejs/esm-utils.js:116:12)
    at Object.exports.loadFilesAsync (/home/sadaf/code/solana-twitter/node_modules/mocha/lib/nodejs/esm-utils.js:103:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


Solution 1:[1]

Updating Node to the latest version solved it for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John.P