I have been getting the following error after adding solana to my project. I have tried adding the @solana/spl-token package ($ yarn add @solana/spl-token) but that didn't work. Please help.
1 Answer
I ran into this error recently. You haven't posted any code, so I've included an example of what was causing it for me, and how I worked around it.
TLDR; Set your version to @solana/spl-token": "^0.2.0".
...
memo ts build is not compatible, but it looks like it might have been fixed or update in the works at least: source.
OR
Instead of:
connection.getParsedTokenAccountsByOwner(publicKey, { programId: TOKEN_PROGRAM_ID });
This made that error disappear, without needed to change spl-token version:
connection.getParsedTokenAccountsByOwner(publicKey, { programId: new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA') });
-
The error didn't resolve for me after following the above steps. Commented Aug 27, 2022 at 10:21