CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 1999
    Posts
    505

    Prob with migrate command on Truffle: Showing ReferenceError and Syntax Error

    Hi,
    I am following the description provided on the web page:

    https://truffleframework.com/tutoria...ble-inspection

    I am trying to execute the “migrate” command on the truffle. It says Reference Error and also gives syntax error:

    Code:
     truffle(development)> migrate
    Using network 'development'.
    
    Running migration: 1_initial_migration.js
      Deploying Migrations...
      ... 0xe37cab98f7bf2521ea31290f8cd831ec68a8a4a2f534bc7008da64daa28fecf3
      Migrations: 0xee9e0e26e6542949d3c32ef2ef8041c68d5bacd8
    Saving successful migration to network...
      ... 0x46e510bfa2fcd87c45c286ae843ed524699988cf8ea882cff7f702a1ccae9564
    Saving artifacts...
    Running migration: 2_deploy_contracts.js
      Deploying Fibonacci...
      ... 0x37ff19549fb84e23a323e5551393111e8d4164259612c1b989450b2c72ca1417
      Fibonacci: 0x062f46a381166602baa7692a1686b7fb0b2ff7e2
    Saving successful migration to network...
      ... 0x13bdf5882017d6284928bd4462d365f0330580536e56576d667423dd512ddedf
    Saving artifacts...
    truffle(development)> truffle(development)> migrate
    ReferenceError: truffle is not defined
    truffle(development)> Using network 'development'.
    evalmachine.<anonymous>:1
    Using network 'development'.
          ^^^^^^^
    
    SyntaxError: Unexpected identifier
        at new Script (vm.js:79:7)
        at createScript (vm.js:251:10)
        at Object.runInContext (vm.js:284:10)
        at Console.interpret (C:\Users\HP\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:94589:17)
        at ReplManager.interpret (C:\Users\HP\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:95306:18)
        at bound (domain.js:396:14)
    Instead of Fibonacci folder, I am using Fibonacci2 folder and also started the testrpc:
    C:\fibonacci2>testrpc
    EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)

    Available Accounts
    ==================
    (0) 0x82d42d57840cc95af8df42283c769762636166fc
    (1) 0x219c27130b7ab0506b5b2bc56bd376dba2a7ad62
    (2) 0xfa9cbe3c1aff9b593c06aa1de789a5cb0af21067
    (3) 0x4d3ce98d30f9cfccae1b9558d6aa11317c088d2f
    (4) 0xd3e3a390064b73c1e4f9efc1eb214dff61b4f66a
    (5) 0xaaa46c09aa132991ed2b9457db8ecbbcb914be83
    (6) 0x8fda0092c64e471a4ef5f6ef4a6574a23dd91008
    (7) 0xcdc51105bb0743b91507a1a6b492388c5599434a
    (8) 0x5562888497e42df6242d23d8f00d3bbbc9c0726e
    (9) 0xd60db2ee1d69652ea432044f1c1a9a2eb8864023

    Private Keys
    ==================
    (0) 94090e3f5d1ef0abadc74062bc5323c948acb77fdcfd8d36622f00173a0bf6ff
    (1) 384d6979f81ea7f36d9b5c81ba0b78d1a082397d9f2a7805a3f947bf70601e5f
    (2) b2782583fa6594b27645e3893eb20c733ba085dee229153fa2cd43a944d3b849
    (3) f9db43b60dba6be6609626373de252503720379a0cb2ecea4e34613c917f44d3
    (4) 9676febc9db2431aa99a7d154cdd4e6c405a02ca92c569885ad060c4f8cb31f5
    (5) e18fadebc5115d2d37f63cb140b556c1efd4e45c5c1807f77f82c5fc924d82a9
    (6) df4be421d627e4f0ce9b8c66917cdb9c74d1dfcd7973c2af0c03ee9fece271ff
    >
    C:\fibonacci2>817ed400029d4eff48930f5aa3816a1289dbccdc89bbac9173083c
    C:\fibonacci2>b9bfc90bbc8ca0b61af95c9ff088ecd13f0f9c66c9725a9a159f26
    C:\fibonacci2>
    C:\fibonacci2>
    C:\fibonacci2>====
    C:\fibonacci2> leader velvet infant hidden garbage bomb deny hotel shoe first call afraid
    C:\fibonacci2> m/44'/60'/0'/0/{account_index}
    C:\fibonacci2>
    C:\fibonacci2>ocalhost:8545
    C:\fibonacci2>
    C:\fibonacci2>
    C:\fibonacci2>
    C:\fibonacci2>testrpc&
    EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)

    Available Accounts
    ==================
    (0) 0x94450db0f5db670eaab74a4135f385a1f6106dd1
    (1) 0x8c7194542ce7229f97da968a6ef833e98f8700bb
    (2) 0x9b94eb78b82daddd1b6f747d2d78283f25f9ab34
    (3) 0x853f332b0aa1a8e94d31095dcfc3ee262d9f2207
    (4) 0x6c9d74e375133457ac4d9644f91e50b738b9911d
    (5) 0x52702ea7a7d6a4319907988dc048e35f9f8a79ea
    (6) 0x178324d7cf2d40799c4d25198132abd3e7fe4712
    (7) 0x8b3bb3a623b7d4834a09e5320402bd8977245f31
    (8) 0x0abd10b80aede580f0b1b0798b702065bd7a2234
    (9) 0xeffdc27074432b8786c3d6619f5e9f39e3a0e5a8

    Private Keys
    ==================
    (0) 37a1be74ef71565f3a9a87111ab30d76dad58460452ac2e86404261f3b7e5dd8
    (1) 82d00ce49b75a483c6f2bb3a7e193ee732cc13970f63aae94ee426e16d2f0ede
    (2) d3506377dd206b85704a7353c2a59036f698b306fd5f785c8b9cfae6e3b7bae7
    (3) 1cc67aae40c5d7e8b6105722ed1650f005bce98c78b4dce66c5ff363b7021ff8
    (4) f5669041a807aeb0923d554c88a8f883657bb8f858b1121cf21bcd1cf47aa15d
    (5) 5f1e72f8ab7901860f86ee1c297b84efffaf11d0be26ff61135719095db8b5fb
    (6) a73672115472d59f609bd682e49e5fdfe03fa52f77b7add300d81825d54ea6cf
    (7) 53064980cb9542989997d721468a7d389bcdd13f9f45f3ae699027bd989c6b09
    (8) 541719b338de156257f4aba44ca2418410f1b69a40c9b43042f791ab5fe29a4e
    (9) 320fa70e20ca755c1d751fbbcef33123cde204fc1e898e88a318db5c30c5d420

    HD Wallet
    ==================
    Mnemonic: resemble stage lesson eight outdoor kingdom flag include curtain unit relax aunt
    Base HD Path: m/44'/60'/0'/0/{account_index}

    Listening on localhost:8545
    >
    My code details are: Fibonacci.sol

    Code:
      
    pragma solidity ^0.4.22;
    
    contract Fibonacci {
    
    uint[] fibseries;
    
      // n = how many in the series to return
      function generateFib(uint n) public {
    
        // set 1st and 2nd entries
        fibseries.push(1);
        fibseries.push(1);
    
        // generate subsequent entries
        for (uint i=2; i < n ; i++) {
          fibseries.push(fibseries[i-1] + fibseries[i-2]);
        }
    
      }
    
    }
    2_deploy_contracts.js

    Code:
    var Fibonacci = artifacts.require("Fibonacci");
    
    module.exports = function(deployer) {
      deployer.deploy(Fibonacci);
    };
    truffle.js

    Code:
        
    
    /*
     * NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a 
     * function when declaring them. Failure to do so will cause commands to hang. ex:
     * ```
     * mainnet: {
     *     provider: function() { 
     *       return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/<infura-key>') 
     *     },
     *     network_id: '1',
     *     gas: 4500000,
     *     gasPrice: 10000000000,
     *   },
     */
    
    module.exports = {
      // See <http://truffleframework.com/docs/advanced/configuration>
      // to customize your Truffle configuration!
    };
    
    module.exports = {
      networks: {
        development: {
          host: "127.0.0.1",
          port: 7545,
          network_id: "*"
        }
      }
    };

    Some body please guide me.

    Zulfi.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,845

    Re: Prob with migrate command on Truffle: Showing ReferenceError and Syntax Error

    After 6 years I guess the OP has moved on......
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured