Skip to content

Instantly share code, notes, and snippets.

@Aschen
Created April 3, 2018 16:42
Show Gist options
  • Save Aschen/ca59f235bdf1701abd3b6cf57a4ff31a to your computer and use it in GitHub Desktop.
Save Aschen/ca59f235bdf1701abd3b6cf57a4ff31a to your computer and use it in GitHub Desktop.
Can't run standalone script : TypeError: fn is not a function
aschen@gman mns/Metacoin » truffle exec test.js
Using network 'development'.
TypeError: fn is not a function
at /home/aschen/.nvm/versions/node/v9.8.0/lib/node_modules/truffle/build/webpack:/~/truffle-require/require.js:128:1
at /home/aschen/.nvm/versions/node/v9.8.0/lib/node_modules/truffle/build/webpack:/~/truffle-require/require.js:101:1
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:532:3)
[6:18:44 PM] Starting server with initial configuration: {"hostname":"127.0.0.1","port":7545,"network_id":5777,"total_accounts":10,"unlocked_accounts":[],"vmErrorsOnRPCResponse":true}
[6:18:44 PM] Ganache started successfully!
[6:18:44 PM] Waiting for requests...
[6:18:52 PM] eth_accounts
[6:18:52 PM] net_version
[6:18:52 PM] net_version
[6:18:52 PM] eth_sendTransaction
[6:18:52 PM] Transaction: 0x9772e19ceeeb17dc2c86114d00078092061223156576f53653359f2d7bbb91d9
[6:18:52 PM] Contract created: 0x4749a7ea06d424792bdcbecb341f382104edae2e
[6:18:52 PM] Gas usage: 268535
[6:18:52 PM] Block Number: 1
[6:18:52 PM] Block Time: Tue Apr 03 2018 18:18:52 GMT+0200 (CEST)
[6:18:52 PM] eth_newBlockFilter
[6:18:52 PM] eth_getFilterChanges
[6:18:52 PM] eth_getTransactionReceipt
[6:18:52 PM] eth_getCode
[6:18:52 PM] eth_uninstallFilter
[6:18:52 PM] eth_sendTransaction
[6:18:52 PM] Transaction: 0xf60b1f3f6e65a52ccb2aba8bc1bd9a839bed15d7bb60ecaddb805542dccd61fa
[6:18:52 PM] Gas usage: 41981
[6:18:52 PM] Block Number: 2
[6:18:52 PM] Block Time: Tue Apr 03 2018 18:18:52 GMT+0200 (CEST)
[6:18:52 PM] eth_getTransactionReceipt
[6:18:52 PM] eth_accounts
[6:18:52 PM] net_version
[6:18:52 PM] net_version
[6:18:52 PM] eth_sendTransaction
[6:18:52 PM] Transaction: 0x1c0095657803859083ea0401fea387611d338852643916e3f2243f940ee50e59
[6:18:52 PM] Contract created: 0xdc13aa70b94babddcfd1963ef9ff0c6bab96baa5
[6:18:52 PM] Gas usage: 105764
[6:18:52 PM] Block Number: 3
[6:18:52 PM] Block Time: Tue Apr 03 2018 18:18:52 GMT+0200 (CEST)
[6:18:52 PM] eth_newBlockFilter
[6:18:52 PM] eth_getFilterChanges
[6:18:52 PM] eth_getTransactionReceipt
[6:18:52 PM] eth_getCode
[6:18:52 PM] eth_uninstallFilter
[6:18:52 PM] eth_sendTransaction
[6:18:52 PM] Transaction: 0x9cf09c3b4028a5ff38c2bc0ce364b31dc12799e4c4fb9c84aa5bc9381d0ea7fc
[6:18:52 PM] Contract created: 0xb173fc460c9d34fb4e83138d1f8a9c3d0b673e7e
[6:18:52 PM] Gas usage: 329118
[6:18:52 PM] Block Number: 4
[6:18:52 PM] Block Time: Tue Apr 03 2018 18:18:52 GMT+0200 (CEST)
[6:18:52 PM] eth_newBlockFilter
[6:18:52 PM] eth_getFilterChanges
[6:18:52 PM] eth_getTransactionReceipt
[6:18:52 PM] eth_getCode
[6:18:52 PM] eth_uninstallFilter
[6:18:52 PM] eth_sendTransaction
[6:18:52 PM] Transaction: 0x56de1fedaa3c56550bcdcf75948677b52118882dbfc55b6bd483290f45db322a
[6:18:52 PM] Gas usage: 26981
[6:18:52 PM] Block Number: 5
[6:18:52 PM] Block Time: Tue Apr 03 2018 18:18:52 GMT+0200 (CEST)
[6:18:52 PM] eth_getTransactionReceipt
var MetaCoin = artifacts.require('./contracts/MetaCoin.sol')
var account_one = "0x83323C7094dD404F2b97a5c5B9c5567da3765B5F"
var meta = MetaCoin.at("0xB173fC460c9d34Fb4e83138D1f8A9C3d0b673e7e")
meta.getBalance.call(account_one, {from: account_one})
.then(function(balance) {
console.log(balance.toNumber());
})
.catch(function(e) {
console.log(e)
})
module.exports = {
networks: {
development: {
host: "localhost",
port: 7545,
network_id: "*" // Match any network id
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment