Problem when using truffle-contract.js to load contract

Hey,

I am having an extremely easy contract called `Friend.sol`:
    pragma solidity ^0.4.17;
    
    contract Friend {
    
        string name;
        uint age;
    
        function setFriend(string _name, uint _age) public {
            name = _name;
            age = _age;
        }
    
        function getFriend() public constant returns (string, uint) {
            return(name, age);
        }
    }
I deployed my contract on ganache-cli:
 Running migration: 1_initial_migration.js
      Deploying Migrations...
      ... 0xa4d581c585527651c4a74a0d85ef2e21ac91a43e17f290f5f548d6e5f0686e22
      Migrations: 0xf741d74fb4d4eab8c044dc4b1c0dfb7a244a6922
    Saving successful migration to network...
      ... 0xca51a8f5124ef4f1dc8dfba5b9a9c1388cda003686309ff152b776600a64cf81
    Saving artifacts...
    Running migration: 2_deploy_contracts.js
      Deploying Friend...
      ... 0x9195ced6c131afaf1e735fc90464f9b94dd4215e909f463f06e51565b5e7e804
      Friend: 0x8a260eec4c77f82bd885b730f782f9bbe680dd64
    Saving successful migration to network...
      ... 0x008b78bf25c5aa93fb6b8f16367d006e68751a54550da32bcce382067ad1250d
    Saving artifacts...
Within my frontend I am trying to access the contract via web3 and truffle-contract:

However, when running my lite-server I get:




The error is, when I want to interact with my contract on the following line:

FriendContract.getFriend(function (error, result) {


I also created a small github repo to show my entire code.

Any suggestions what I am doing wrong?
Sign In or Register to comment.