Tag Archives: can not find module

Using Mocha to test can not find module ‘. /build/release/scrypt’ (Fixed)

I had a small problem learning the MoCHA testing framework and the Ganache-CLI testing environment
Install the video in the test code to write the following rules

const assert = require('assert');
const ganache = require('ganache-cli');
//If a variable begins with a capital letter, it is a constructor
const Web3 = require('web3');
//Plug the ganache test network card into web3.
const web3 = new Web3(ganache.provider());


describe('Testing Smart Contracts',()=>{
    it('Testing the web3 version',()=>{
        console.log(web3.version);
    });
});

Then enter NPM Run Test on the Terminal page
Cannot find module ‘./build/Release/scrypt’
Location is (F: \ MyEclipseWorkspace, Solidity, the Inbox, node_modules \ scrypt \ index js: 3:20)
Change the line code to
//var scryptNative = require(“./build/Release/scrypt”)
var scryptNative = require(“scrypt”)
Run the output test results again