Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Zeppeelin contracts not found (on windows) #22

Open
martinoss opened this issue Jul 20, 2021 · 0 comments
Open

Open Zeppeelin contracts not found (on windows) #22

martinoss opened this issue Jul 20, 2021 · 0 comments

Comments

@martinoss
Copy link

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant