demo-apps
demo-apps copied to clipboard
Open Zeppeelin contracts not found (on windows)
Wanted to check out the casino-dapp and followed the steps from the readme. When trying to run the migrate command, I got errors that contracts from open zeppelin could not be found. Guess its the way the drive is spelled.
I was able to fix it by omitting ../node_modules/
from the import statements and make it look like this:
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
If it still works on other platforms like this, I suggest to also omit ../node_modules/
in this sample.
C:\Code\GitHub\demo-apps\casino-dapp\truffle (main -> origin) ([email protected])
λ truffle console
truffle(ganache)> migrate
Compiling your contracts...
===========================
> Compiling .\contracts\Migrations.sol
> Compiling .\contracts\flipcontract.sol
> Compiling .\node_modules\@openzeppelin\contracts\access\Ownable.sol
> Compiling .\node_modules\@openzeppelin\contracts\math\SafeMath.sol
> Compiling .\node_modules\@openzeppelin\contracts\utils\Context.sol
> Compilation warnings encountered:
/C/Code/GitHub/demo-apps/casino-dapp/truffle/contracts/flipcontract.sol: Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
/C/Code/GitHub/demo-apps/casino-dapp/truffle/contracts/flipcontract.sol:1:1: ParserError: Source "/C/Code/GitHub/demo-apps/casino-dapp/truffle/node_modules/@openzeppelin/contracts/access/Ownable.sol" not found
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
^------------------------------------------------------------------^
,/C/Code/GitHub/demo-apps/casino-dapp/truffle/contracts/flipcontract.sol:2:1: ParserError: Source "/C/Code/GitHub/demo-apps/casino-dapp/truffle/node_modules/@openzeppelin/contracts/math/SafeMath.sol" not found
import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
^-----------------------------------------------------------------^
Compilation failed. See above.