anchor
anchor copied to clipboard
Use PNPM and Bun instead of Yarn to install packages and run Anchor tests
Why does Anchor lock JS package manager and runtime to Yarn? PNPM saves more disk spaces in installing JS packages. Bun runs much faster and supports TypeScript natively.
I can use pnpm
to reinstall everything after importing yarn.lock
, and deleting node_modules
But in the Anchor.toml
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
When I changed yarn
into bun
, anchor test
command failed.
Error: Simulation failed.
Message: Transaction simulation failed: Error processing Instruction 0: invalid account data for instruction.
Logs:
[
"Program qu3BpUtF7Qv6fHztxeAEbVXeJe... invoke [1]",
"Program is not deployed",
"Program qu3BpUtF7Qv6fHztxeAEbVXeJe... failed: invalid account data for instruction"
].
Catch the `SendTransactionError` and call `getLogs()` on it for full details.
at Connection.sendEncodedTransaction (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@solana/web3.js/src/connection.ts:6006:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Connection.sendRawTransaction (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@solana/web3.js/src/connection.ts:5962:20)
at sendAndConfirmRawTransaction (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@coral-xyz/anchor/src/provider.ts:377:21)
at AnchorProvider.sendAndConfirm (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@coral-xyz/anchor/src/provider.ts:163:14)
at MethodsBuilder.rpc [as _rpcFn] (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@coral-xyz/anchor/src/program/namespace/rpc.ts:29:16)
Please advise. Thanks