openzeppelin-sdk icon indicating copy to clipboard operation
openzeppelin-sdk copied to clipboard

Projects with no `.openzeppelin` directory and no `package.json` error on `npx oz compile`: No contracts found to compile.

Open abcoathup opened this issue 6 years ago • 2 comments

Projects with no .openzeppelin directory and no package.json , e.g. where npm init and npx oz init have't been run will error when attempting to compile using npx oz compile.

$ npx oz compile
No contracts found to compile.

To reproduce create a new project with a contracts directory containing a contract and then attempt to compile.

Once an openzeppelin directory is created compilation is allowed

$ mkdir .openzeppelin
$ npx oz compile
✓ Compiled contracts with solc 0.5.16 (commit.9c3226ce)

abcoathup avatar Jan 10 '20 03:01 abcoathup

I have not been able to reproduce this using 2.6: npx oz compile works fine on my machine on new project with Solidity sources inside contracts and no .openzeppelin directory.

nventuro avatar Jan 10 '20 21:01 nventuro

@nventuro the error appears to only be when there also isn't a package.json too. I have updated the title.

Steps to reproduce:

$ mkdir issue1378 && cd issue1378
$ npm install --save-dev @openzeppelin/cli
$ mkdir contracts

Save Simple.sol contract into contracts directory. nano contracts/Simple.sol

Simple.sol

pragma solidity ^0.5.0;

contract Simple {
}
$ npx oz compile
No contracts found to compile.

abcoathup avatar Jan 13 '20 03:01 abcoathup