Nodejs

2016-10-06 3 views
0

を使用してイーサリアムノードに接続として、私は次のようイーサリアムノード実行している:私がインストールされているNodejs

--rpc --rpcaddr "127.0.0.1" --rpcport "8000" --rpccorsdomain "*" --datadir "/home/mohammad/Ethereum/Data/node1" --port "30303" --maxpeers 2 --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3,solc" --rpcapi "db,eth,net,web3,personal" --networkid 1900 --nat "any" --unlock "0" --nodiscover console init ~/Ethereum/Data/node1/customgenesis.json 

以下のよう nodejsからこのノードに接続するweb3:

var Web3 = require('web3'); 
var web3 =Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8000')); 
console.log(web3.version.api) 

けど、このエラーが発生します

TypeError: Cannot read property 'version' of undefined

これはどうして起こりますか?

答えて

0

Web3(...

)の前に新しいキーワードを忘れました。