Uncaught Error: Cannot find module './truffle-contract.min.js' at c (web3.min.js:1) at c (web3.min.js:1) at index.html:27

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script type="text/javascript" src="./web3.min.js"></script>
    <script type="text/javascript" src="./truffle-contract.min.js"></script>
    <title>Test For blockchain</title>
        var Web3 = require("web3");
        if (typeof web3 !== 'undefined')
            web3 = new Web3(web3.currentProvider); 
            web3 = new Web3(new Web3.providers.HttpProvider("https://shivansh.blockchain.azure.com:3200/######")); 
        //wb = new Web3(web3);
        //var HelloBlockchain = artifacts.require("HelloBlockchain");

        let contract = require('./truffle-contract.min.js')
        let HelloWorld = contract(require('./build/contracts/HelloBlockchain.json'))

        HelloWorld.deployed().then(contract => {
        return contract.getMessage()
        }).then(response => {

1 Answer 1


Make sure you have truffle-contract.min.js file in the same location as you are providing in your code i.e.,


  • It is in the correct place. Commented Aug 16, 2019 at 19:10
  • Can you show me the directory structure(including this file) of your project? Commented Aug 16, 2019 at 19:26
  • I can't since i have deleted the project as it was just for testing making a simple blockchain but I am sure that the minified truffle contract file was in the root folder. Commented Aug 16, 2019 at 19:40

Your Answer

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

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