OpenZeppelin contracts 0.8 not installing


I just posted there: How to specify the version of imported OpenZeppelin Contracts? - #6 by wat but the topic was pretty old. I can’t follow properly the steps described here: as it doesn’t work as described on my Macbook:

  • npm install @openzeppelin/contracts → only installs pragma solidity ^0.5.0 so I end up with an error

These files import other files that use a different and incompatible version of Solidity:
** contracts/GLDToken.sol (^0.8.0) imports @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.5.0)**

  • npm install @openzeppelin/contracts@solc-0.7 → doesn’t work, error ‘No matching version found for @openzeppelin/contracts@solc-0.7’

anyone else with this problem?

Thanks for your help

I think when you ran npm install @openzeppelin/contracts, it will install the latest version, and the latest version is the 4.1.0, and it use the solidity version is 0.8.x, I just had a try, it worked well:

and if you want to install the solidity version of 0.7.x, I think you should run npm i @openzeppelin/contracts@3.4.1-solc-0.7-2 or npm i @openzeppelin/contracts@3.4.1

Hi, thanks for your feedback, maybe I was not explicit enough, but in the tutorial link you will see you can create your own token with Solidity 0.8.
When I do that I get the error below:

I assumed it was because it was not the good solidity version but maybe the problem is somewhere else?

I don’t see contracts@4.1.0 neither

It seems like you installed a wrong version, just re-installed the package.

npm uninstall @openzeppelin/contracts
npm install @openzeppelin/contracts