[Issue] Having trouble getting started with zos

Hello friends. I started adding zos and the upgradable contracts to my existing project, following along here and here but I’m having trouble with zos commands push and add.

Even though I have my contracts compiled, looks like it tries to recompile anyways, and global node_modules look like they’re being ignored. And if I add the relative path to the modules in my contract, it gives the error that within Pausable.sol in the openzeppelin-eth lib, it can’t import Initializable.sol.

Check out my terminal output:

carlos:babylon$ truffle compile --all

Compiling your contracts...
===========================
> Compiling ./contracts/Babylon.sol
> Compiling ./contracts/BabyloniaToken.sol
> Compiling ./contracts/EthPriceOracleI.sol
> Compiling ./contracts/EthPriceOracleMock.sol
> Compiling ./contracts/HelbizToken.sol
> Compiling ./contracts/Migrations.sol
> Compiling openzeppelin-eth/contracts/access/Roles.sol
> Compiling openzeppelin-eth/contracts/access/roles/MinterRole.sol
> Compiling openzeppelin-eth/contracts/access/roles/PauserRole.sol
> Compiling openzeppelin-eth/contracts/lifecycle/Pausable.sol
> Compiling openzeppelin-eth/contracts/math/SafeMath.sol
> Compiling openzeppelin-eth/contracts/ownership/Ownable.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20Burnable.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20Detailed.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20Mintable.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20Pausable.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/IERC20.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/StandaloneERC20.sol
> Compiling zos-lib/contracts/Initializable.sol
> Artifacts written to /Users/carlos/Desktop/helbiz/babylon/build/contracts
> Compiled successfully using:
   - solc: 0.5.0+commit.1d4f565a.Emscripten.clang

carlos:babylon$ npx zos add Babylon
Compiling contracts with Truffle...
Error compiling:

Cannot find import Pausable.sol from Babylon.sol. If it's a relative path, ensure it starts with `./` or `../`.
Compilation failed. See above.

Command failed: /Users/carlos/Desktop/helbiz/babylon/node_modules/.bin/truffle compile --all

carlos:babylon$ npx zos add Babylon
Compiling contracts with Truffle...
Error compiling:

Cannot find import Initializable.sol from Pausable.sol. If it's a relative path, ensure it starts with `./` or `../`.
Compilation failed. See above.

Command failed: /Users/carlos/Desktop/helbiz/babylon/node_modules/.bin/truffle compile --all

Hi @imthatcarlos thanks for raising this. I’m tagging @spalladino to have a look on this.

Hey @imthatcarlos! It’s odd that the same truffle compile command is failing when running it locally from zos vs globally. Can you try the following…?

  • Check the versions of the tools you are using: zos version, truffle version, and npx truffle version
  • Compiling with local truffle: npx truffle compile --all instead of truffle compile --all
  • If the output of truffle version and npx truffle version differ, install the same truffle locally as the one you have globally

@spalladino yep, the versions were different and installing the same truffle locally worked! Thanks for the help!