Search code examples
visual-studio-codesolidityopenzeppelinbrownieerc721

Brownie compile ValueError: Invalid NPM block with OpenZeppelin


*****top lines of my .sol file // SPDX-License-Identifier: MIT pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

contract ParcelAsset is ERC721 {

******command line VScode brownie compile contracts\ParcelAsset.sol

I get this error. ValueError: Invalid NPM block in '>=0.6.0 <0.8.0 import "@openzeppelin/contracts/token/ERC721/ERC721.sol"': 'import'

*********** snippet of my brownie-config.yaml dependencies:

I have tried npm install @openzeppelin/contracts and upadating solidity to 0.8.0

Anyone known what I am doing wrong?


Solution

  • I solved it by doing: npm install @chainlink/contracts --save

    and in the yaml file doing:enter image description here

    I personally didn't bother importing openzeppelin because all safemath functionalities (if that is what you are importing) are already implemented into solidity 0.8.0, so if you're using solidity 0.8.0, the safemath library is obsolete