I'm writing my own application that follows a similar form to the Truffle Pet Shop.

I have the following code in my app.js:

initContracts: function(){
    $.getJSON('Greeter.json', function(data) {
        var GreeterArtifact = data;
        App.contracts.Greeter = TruffleContract(GreeterArtifact)
    return App.sayHello();

I'm getting the following console error:

Uncaught ReferenceError: TruffleContract is not defined
    at Object.success (app.js:34)

The only difference between me and the Truffle Pet Shop is that they have a truffle-contract.js file in their js folder. I installed truffle-contract with npm and it's listed in my package.json.

Any idea why I'm getting this error?

  • which version of web3 are you using? – wandos Jul 17 at 11:07

Your Answer

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

Browse other questions tagged or ask your own question.