Could not find @openzeppelin/contracts/token/ERC20/ERC20Detailed.sol from any sources

HI,
I have the same problem I’m trying to compile a token contract and get error:
Could You help me please, I can’t solve my problem.

Error: Could not find @openzeppelin/contracts/token/ERC20/ERC20Detailed.sol from any sources; imported from C:/Users/majo1/SimpleGame/Solidity/contracts/GameToken.sol
at Resolver. (C:\Users\majo1\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\resolver\dist\lib\resolver.js:62:1)
at Generator.next ()
at fulfilled (C:\Users\majo1\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\resolver\dist\lib\resolver.js:5:42)
Environment :
Truffle 5.1.63
Node 14.15.4
Solidity 0.5.16

1 Like

Hi @MajoGro,

Welcome to the community :wave:

ERC20Detailed.sol was included in ERC20.sol from OpenZeppelin Contracts 3.x

If you want to use your code as is you can import the older version of OpenZeppelin Contracts 2.x
npm install @openzeppelin/contracts@2.5.1

Though I would recommend updating to use the latest version, OpenZeppelin Contracts 3.4.
npm install @openzeppelin/contracts

The documentation has an example ERC20:
https://docs.openzeppelin.com/contracts/3.x/erc20#constructing-an-erc20-token-contract

Hello,

thank you for accepting me into the community. With your help, I succeeded. This is crazy. I’m on my way to becoming a blockchain developer again.
Majo

1 Like

Hi @MajoGro,

Glad you resolved.

If you get a chance it would be great to Introduce yourself here!

Hi Andrew,
now I’m coding RefungibleToken and have the same problem like before. I’m trying to compile a token contract and I get error:

Error: Could not find @openzepplin/contracts/token/ERC20/IERC20.sol from any sources; imported from C:/Users/majo1/EatTheBlocks/ReFungibletoken/contracts/ReFungibleToken.sol
    at Resolver.<anonymous> (C:\Users\majo1\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\resolver\dist\lib\resolver.js:62:1)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\majo1\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\resolver\dist\lib\resolver.js:5:42)

Last time you advised me to install in my project the older version of openzeppelin and it worked. Now I did try to install all different versions of openzeppelin (3.3.0-solc-0.7, 3.4.0-solc-0.7, 3.2.1-solc-0.7) and I get the same error.
Environment :
Truffle 5.1.63
Node 14.15.4
Solidity 0.7.3
Where is problem ?
Once you advised one member that he install openzeppelin locally and not globally. What this means? Is this means that he install in folder where code is ?
Thanks.
Majo

1 Like

Hi @MajoGro,

You have a typo on your import, you are missing an e in zeppelin, it should be @openzeppelin/contracts.