Truffle migrate shows Error: Cannot find module 'truffle-expect'

–1 vote

I face no problem while compiling the contract. But when I migrate it, I get below 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)

Smart Contract:

pragma solidity^0.4.11;
contract HelloWorld {
    uint public balance;
    function HelloWorld(){
        balance = 1000;
    }
}

2_deploy_contract.js

var HelloWorld = artifacts.require("./HelloWorld.sol");
module.exports = function(deployer) {
  deployer.deploy(HelloWorld);
};
Jan 18 in Blockchain by digger
• 26,550 points

edited Jan 18 by digger 45 views

2 answers to this question.

0 votes

As mentioned in the error: truffle-expect is missing. Install this:

npm install -g truffle-expect truffle-config web3

Now start testrpc on another terminal and then try migrating.

answered Jan 18 by Omkar
• 67,660 points
0 votes

You can also install the basic truffle-expect using the following command:

$ ​npm install -g truffle-expect
answered Feb 19 by Rohit

Related Questions In Blockchain

0 votes
4 answers

Hyperledger fabric: enrollAdmin.js Error: Cannot find module 'fabric-client'

Change your directory to fabric-samples/fabrcar. And run: npm ...READ MORE

answered Nov 21, 2018 in Blockchain by Omkar
• 67,660 points
1,265 views
0 votes
1 answer

Not able to migrate contract in Truffle: Error: No network specified. Cannot determine current network

Make these entries in truffle.js file: module.exports = { ...READ MORE

answered Nov 29, 2018 in Blockchain by Omkar
• 67,660 points
132 views
0 votes
2 answers

Truffle compile: Cant find module error

You can install babel-register and try again. ...READ MORE

answered Feb 19 in Blockchain by Loki
210 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
170 views
0 votes
1 answer
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
91 views
0 votes
1 answer

truffle migrate Error: “Cannot find module 'truffle-expect'”

Seems like you are missing some modules ...READ MORE

answered Jan 23 in Blockchain by Omkar
• 67,660 points
54 views
0 votes
1 answer

Truffle init: Error: Cannot find module 'original-require'

I think you need to run this ...READ MORE

answered Oct 24, 2018 in Blockchain by Omkar
• 67,660 points
185 views