Got Cannot find module `./build/Release/scrypt` when run `npm run test`

I ran npm run test on openzeppelin-solidity itself and got Error: Cannot find module './build/Release/scrypt'. I expected to see test result.

:computer: Environment
OS: Kubuntu 18.04 LTS
Truffle v5.0.24
Web3.js v1.0.0-beta.37
Node v12.6.0
openzeppelin-solidity: commit#c9f328ef66251db7fac7c704dd6c5523fc53b0ab

:memo:Details

  1. I cloned openzeppelin-solidity.
  2. Installed dependencies with npm i
  3. ran npm run test and got
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Error: Cannot find module './build/Release/scrypt'
Require stack:
- /home/title/workspace/openzeppelin-solidity/node_modules/scrypt/index.js
- /home/title/workspace/openzeppelin-solidity/node_modules/scrypt.js/node.js
- /home/title/workspace/openzeppelin-solidity/node_modules/web3-eth-accounts/src/index.js
- /home/title/workspace/openzeppelin-solidity/node_modules/web3-eth/src/index.js
- /home/title/workspace/openzeppelin-solidity/node_modules/web3/src/index.js
- /home/title/workspace/openzeppelin-solidity/node_modules/truffle-contract/lib/contract.js
- /home/title/workspace/openzeppelin-solidity/node_modules/truffle-contract/index.js
- /home/title/workspace/openzeppelin-solidity/node_modules/openzeppelin-test-helpers/src/singletons.js
- /home/title/workspace/openzeppelin-solidity/node_modules/openzeppelin-test-helpers/index.js
- /home/title/workspace/openzeppelin-solidity/test/crowdsale/AllowanceCrowdsale.test.js
- /home/title/workspace/openzeppelin-solidity/node_modules/mocha/lib/mocha.js
- /home/title/workspace/openzeppelin-solidity/node_modules/mocha/index.js
- /home/title/workspace/openzeppelin-solidity/node_modules/truffle/build/cli.bundled.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/title/workspace/openzeppelin-solidity/node_modules/scrypt/index.js:3:20)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/title/workspace/openzeppelin-solidity/node_modules/scrypt.js/node.js:1:14)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/title/workspace/openzeppelin-solidity/node_modules/web3-eth-accounts/src/index.js:35:16)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/title/workspace/openzeppelin-solidity/node_modules/web3-eth/src/index.js:37:16)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)

:1234: Code to reproduce
I ran tested on https://github.com/OpenZeppelin/openzeppelin-solidity/commit/c9f328ef66251db7fac7c704dd6c5523fc53b0ab.

1 Like

Hi @varshard welcome to the community.

Unfortunately we can’t currently use node 12 with Truffle so need to use node 11 or node 10.

Housekeeping, marked my reply as the solution. Please ask all the questions that you need @varshard

1 Like