8

I'm following a solidity tutorial right now and I'm currently encountering an error when I run truffle migrate. Also, testrpc is running in another terminal tab, so this issue is unrelated to the others on here.

I run truffle init and then add my HelloWorld.sol smart contract to the contracts folder.

pragma solidity ^0.4.11;

contract HelloWorld {
    uint public balance;

    function HelloWorld(){
        balance = 1000;
    }
}

I then run truffle compile and everything works fine

Compiling ./contracts/ConvertLib.sol... 

Compiling ./contracts/HelloWorld.sol... 

Compiling ./contracts/MetaCoin.sol...

Compiling ./contracts/Migrations.sol... 

Writing artifacts to ./build/contracts

I then added the following to my 2_deploy_contracts.js migration file

var HelloWorld = artifacts.require("./HelloWorld.sol");

module.exports = function(deployer) {
  deployer.deploy(HelloWorld);
};

However when I run truffle migrate I receive the following error:

Error: Cannot find module 'truffle-expect'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:85773:14)
    at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:21:30)
    at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:59914:15)
    at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:21:30)
    at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:201851:15)
    at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:21:30)

I've tried npm installing truffle-expect but that doesn't seem to work either... Any thoughts?

0

2 Answers 2

12

1) Run the following command:

npm install -g truffle-expect truffle-config web3

2) Run testrpc in another shell instance

3) Run truffle migrate in your truffle project directory

0
1

It looks like this a current issue with the module that's soon going to be patched.

This bug is fixed, but we never pushed out a new version. Added tests here. Will push out a new version of Truffle with the fix once the changes are approved. trufflesuite/truffle-require#6

https://github.com/trufflesuite/truffle/issues/383

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.