web3.isConnected() has issue. When connecting to an IPC node

I think it is waiting for something because when i starting my nodejs program nothing happens,

I am running ethereum node and try to connect with my Dapp
But there is some problem with my rpc connection that is web3.isConnected() is not returning anything
It should return true or false

2 Answers 2


If you have MetaMask installed and using it, select custom RPC and put http://localhost:4000.

In case of MetaMask, call new Web3 instance, web3js(or anything else), as web3 is already defined.

if (typeof web3 !== 'undefined') 
    web3js = new Web3(web3.currentProvider);
else {
    web3js = new Web3(new Web3.providers.HttpProvider('http://localhost:4000'));

web3.isConnected() has issue. When connecting to an IPC node, it will always hang up if that IPC node is up and running but PORT is not OPEN

Your Answer

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

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