0

Please, i need help. I am using truffle to test a smart contract. I run "truffle develop", then "migrate". The contract has been stored in the network. Then I run the command "test". An error occurred: Cannot find module 'pify' The tests use web3.js from OpenZeppelin. The file contains the string

const pify = require('pify');

What should I do to fix this error?

  • Could you explain what you mean by "web3.js from OpenZeppelin"? (Maybe provide a link or explain how you installed it?) – user19510 Aug 18 '18 at 15:36
  • Thanks for replying! See link github.com/OpenZeppelin/openzeppelin-solidity/blob/master/test/… – Alex Agadganov Aug 18 '18 at 17:09
  • Did you install with the instructions at github.com/OpenZeppelin/openzeppelin-solidity? If not, what was your installation command, and did you see any errors? – user19510 Aug 18 '18 at 17:17
  • I copied three files from OpenZeppelin's repository (web3.js, increaseTime.js, latestTime.js) in folder "helpers" . This folder is located next to the contract folder. I call the function "latestTime" in test file. This function depends on web3.js. – Alex Agadganov Aug 18 '18 at 17:25
  • That's not going to work. You need to follow the instructions and actually install the library. – user19510 Aug 18 '18 at 17:39
0

Try going to the root of your truffle project and run:

npm install pify

to install the pify package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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