Brownie: CompilerError: File outside of allowed directories

Question:

I’m trying to import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" to my contract but i encountered this error. CompilerError: solc returned the following errors:

contracts/Lottery.sol:4:1: ParserError: Source "C:/Users/Алексей/.brownie/packages/smartcontractkit/chainlink-brownie [email protected]/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File outside of allowed directories.
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
^————————————————————————–^

This is my contract (Lottery.sol):

    // SPDX-License-Identifier: MIT
    pragma solidity ^0.6.6;

    import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

    contract Lottery {

        address payable[] public players;
        uint256 public usdEnterFee;
        AggregatorV3Interface internal ethUsdPriceFeed;

        constructor(address _priceFeedAddress) public {
            usdEnterFee = 50 * (10 ** 18);
            ethUsdPriceFeed = AggregatorV3Interface(_priceFeedAddress);
        }

        function enter() public payable {
            players.push(msg.sender);
        }

        function getEnterFee() public view returns(uint256) {

        }

        function startLottery() public {

        }

        function endLottery() public {

        }

    }

This is brownie-config.yaml:

    dependencies:
      - smartcontractkit/[email protected]
    compiler:
      solc:
        remappings:
          - '@chainlink=smartcontractkit/chainlink-brownie [email protected]'

Error:
enter image description here

Asked By: Alexey Kasatkin

||

Answers:

it doesn’t find aggregatorV3interface.sol

Have you installed it?

try pip3 install @chainlink/contracts or npm install @chainlink/contracts

if you already done it, check if it is in the right path

Answered By: Jacopo Mosconi

A "-" is missing in the "remappings:"
it should be:

    remappings:
  - '@chainlink=smartcontractkit/[email protected]'
Answered By: Yucai Zou