New to solana, going through my first tut.
The first task is to generate a keypair from the web3.js package.
my file --
import { Keypair } from "@solana/web3.js";
const keypair = Keypair.generate();
console.log(`The public key is: `, keypair.publicKey.toBase58());
console.log(`The secret key is: `, keypair.secretKey);
console.log(`✅ Finished!`);
my output --
SyntaxError: Octal escape sequences are not allowed in strict mode.
at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:139:18)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:236:14)
at async link (node:internal/modules/esm/module_job:67:21)
I don't think this is a solana error but the stuff I'm finding online about this is pretty obscure and less than helpful. Does anyone know why I'm getting this.
here is how I'm calling the file -
npx esrun genKeyPair.ts
my package.json
{
"name": "generate-keypair",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@solana-developers/node-helpers": "^1.2.1",
"@solana/web3.js": "^1.87.6",
"esrun": "^3.2.26",
"typescript": "^5.3.3"
}
}
strict
mode via your tsconfig.jsonnode:internal/modules/esm/loader:236:14
- what version of node.js are you using? Can you try upgrading to the current latest 18x or 20.x?