Import "@openzeppelin..."; Issue

I am having a bit of an issue. :cry:

I am wanting to import the ERC20 open zeppelin library to my contract.

Unfortunately, when I run truffle test, I get:

 ParserError: Expected string literal (path), "*" or alias list.

import "@openzeppelin\contracts\token\ERC20\ERC20.sol";

I have tried reinstalling openzepplin, truffle, solidity and even npm and node itself.

No luck.

Here is a pic of the cmd error. I would add the text editor state, but I am limited to one pic as a new user.

Have you installed openzeppelin contract package yet:

npm install @openzeppelin/contracts

Verify in the node_module to see if your contract successfully installed.

Or you can try from
import β€œ@openzeppelin\contracts\token\ERC20\ERC20.sol”;

to this
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

I think it’s wrong typo.


Like @saingsab said, try using forward slashes / instead of backward slashes \.



Hey guys, so the issue was that my @openzeppelin folder in node_modules was empty. Thanks for the help.