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

Error: Could not find zeppelin-solidity/contracts/crowdsale/Crowdsale.sol from any sources #137

Closed
k06a opened this issue Oct 18, 2017 · 13 comments

Comments

@k06a
Copy link

k06a commented Oct 18, 2017

We are using zeppelin-solidity package.

Error: Could not find zeppelin-solidity/contracts/crowdsale/Crowdsale.sol from any sources; imported from /home/travis/build/bitclave/crowdsale/coverageEnv/contracts/BonusCrowdsale.sol

https://travis-ci.org/bitclave/crowdsale/builds/289704002

@cgewecke
Copy link
Member

Hi @k06a.
If you're doing this in your solidity files:

import "zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";

Do this in your .solcover.js config file

module.exports = {
  copyNodeModules: true
}

At the moment we don't automatically copy the modules because it can take a long time and this is only a problem when importing solidity into solidity from npm installed packages. Solidity's import directive doesn't recursively search outside the parent directory the way JS import or require does.

@k06a
Copy link
Author

k06a commented Oct 18, 2017

@cgewecke thanks for instant reply! I'll try in a few minutes.

@k06a
Copy link
Author

k06a commented Oct 18, 2017

@cgewecke having a new issue: https://travis-ci.org/bitclave/crowdsale/builds/289719158

/home/travis/build/bitclave/crowdsale/coverageEnv/test/BaseCrowdsaleTest.js:3
import {duration, increaseTimeTo} from "./helpers/increaseTime";
^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at /home/travis/build/bitclave/crowdsale/node_modules/truffle/node_modules/mocha/lib/mocha.js:231:27

Content of .solcover.js:

require('babel-register');
require('babel-polyfill');

module.exports = {
  copyNodeModules: true
}

I was partially copied from truffle.js config:

require('babel-register');
require('babel-polyfill');

module.exports = {
    networks: {
        development: {
            host: "localhost",
            port: 8545,
            network_id: "*",
            gas: 6000000
        }
    }
};

@cgewecke
Copy link
Member

See #136.

@k06a
Copy link
Author

k06a commented Oct 19, 2017

@cgewecke what is coverage network? Sorry, I'm really new to JS/Solidity.

@k06a
Copy link
Author

k06a commented Oct 19, 2017

@cgewecke does it mean to add this to truffle.js?

require('babel-register');
require('babel-polyfill');

module.exports = {
    networks: {
        development: {
            host: "localhost",
            port: 8545,
            network_id: "*",
            gas: 6000000
        },
        coverage: {
            host: "localhost",
            port: 8545,
            network_id: "*",
            gas: 6000000
        }
    }
};

@k06a
Copy link
Author

k06a commented Oct 19, 2017

My next problem https://travis-ci.org/bitclave/crowdsale/builds/289838038:

testRpc stdout:
EthereumJS TestRPC v4.0.2 (ganache-core: 1.0.1)
testRpc stderr:
events.js:163
      throw er; // Unhandled 'error' event
      ^
Error: listen EADDRINUSE :::8545
    at Object.exports._errnoException (util.js:1050:11)
    at exports._exceptionWithHostPort (util.js:1073:20)
    at Server.setupListenHandle [as _listen2] (net.js:1259:14)
    at listenInCluster (net.js:1307:12)
    at Server.listen (net.js:1406:7)
    at Server.server.listen (/home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:119382:17)
    at Object.<anonymous> (/home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:41896:8)
    at __webpack_require__ (/home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:21:30)
    at /home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:64:18
    at Object.<anonymous> (/home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:67:10)

@k06a
Copy link
Author

k06a commented Oct 19, 2017

Added pkill -9 testrpc step before coverage step in .travis.yml

@k06a
Copy link
Author

k06a commented Oct 19, 2017

Added testrpcOptions to increase gas limit to .solcover.js:

require('babel-register');
require('babel-polyfill');

module.exports = {
  copyNodeModules: true,
  testrpcOptions: '-l 6000000'
}

Reference: https://www.npmjs.com/package/solidity-coverage

@k06a
Copy link
Author

k06a commented Oct 19, 2017

Right now using following configuration of truffle.js:

require('babel-register');
require('babel-polyfill');

module.exports = {
    networks: {
        development: {
            host: "localhost",
            port: 8545,
            network_id: "*",
            gas: 10000000
        },
        coverage: {
            host: "localhost",
            port: 8545,
            network_id: "*",
            gas: 10000000
        }
    }
};

Content of .solcover.js:

require('babel-register');
require('babel-polyfill');

module.exports = {
  copyNodeModules: true,
  norpc: true
}

Content of .travis.yml:

sudo: required
dist: trusty
language: node_js
node_js:
  - '7'
install:
  - npm install -g truffle
  - npm install -g ethereumjs-testrpc
  - npm install
script:
  - npm test
before_script:
  - scripts/rpc.sh > /dev/null &
  - sleep 5
after_script:
  - npm run coverage && cat coverage/lcov.info | coveralls

Content of rpc.sh:

#!/usr/bin/env bash
testrpc -l 10000000

I am having problems with gas:

  1) Contract: Crowdsale:  "before all" hook:
     Error: VM Exception while processing transaction: out of gas

https://travis-ci.org/bitclave/crowdsale/builds/289971276

10M of gas should be enough!

@cgewecke
Copy link
Member

cgewecke commented Oct 19, 2017 via email

@cgewecke
Copy link
Member

cgewecke commented Oct 19, 2017 via email

@k06a
Copy link
Author

k06a commented Oct 20, 2017

Finally fixed my issues. Do not know how exactly: https://github.com/bitclave/crowdsale
@cgewecke thanks for help!

@k06a k06a closed this as completed Oct 20, 2017
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

2 participants