我试图遵循本教程
这是一个关于Solana程序开发的教程,我想在ubuntu 20.0上使用yarn会导致错误我犯了一个我无法理解的错误感谢提供的所有帮助
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.
将Node更新到最新版本为我解决了这个问题。