I have the following ethereum node running as :

sudo geth --rpc --rpcaddr "" --rpcport "8000" --rpccorsdomain "*" --datadir "/home/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

I have installed web3 to connect to this node from nodejs as the following :

var Web3 = require('web3');
var web3 =Web3(new Web3.providers.HttpProvider(''));

but, I am getting this error

TypeError: Cannot read property 'version' of undefined

Any idea why this happens?

1 Answer 1


You forgot the new keyword before Web3(...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.