VSCode cannot find ERC20 contract

I'm trying to get started with a simple contract and VSCode keeps giving me a hard time when trying to import the OpenZeppelin ERC20contract.
I'm using the Juan Blanco solidity extension.

ParserError: Source "@openzeeppelin/contracts/token/ERC20/ERC20.sol" not found: File not found. Searched the following locations: "". --> contracts/usdc.sol:4:1: | 4 | import "@openzeeppelin/contracts/token/ERC20/ERC20.sol";

Initially I had another error but it was resolved after downgrading the extension version.
'Source “@openzeppelin/contracts/token/ERC20/ERC20.sol” not found: File import callback not supported'

It won't let me compile the contract.

Did anyone have a similar problem?

You have spelled @openzeeppelin wrong. It should be :

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
1 Like