I am a new!


var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));

enter image description here

enter image description here

why the error is web3.isConnected is not a function? thx!

2 Answers 2


Your problem is caused by the Web3 version your are currently using. I guess it is 1.0.0-beta.18

In package.json, you must have

"dependencies": {
    "web3": "^1.0.0-beta.18"

Solution 1: Downgrade to a stable version

I recommend to downgrade to the latest stable version 0.19.0

i Edit package.json

ii Change the version of web3

"dependencies": {
    "web3": "0.19.0"

Solution 2: Keep using the beta

First of all, the documentation is here.

I think (not 100% sure), this code should do the job to check if the client is connected or not to the node:

var Web3 = require('web3');
var provider = new Web3.providers.HttpProvider('http://localhost:8545');
var web3 = new Web3(provider);


You might need to install web3-net: npm install --save web3-net

  • yes,i use "1.0.0-beta.18",thank you
    – Dave
    Sep 19, 2017 at 3:35

You are using pre-1.0 version of web3 from a place where the provider object does not have the method isConnected() defined.

From the picture above, I've guessing this is ganache-cli or truffle develop, formerly testrpc. I guess these clients have a custom provider because both HttpProvider and IpcProvider do have these functions defined.

Apparently this method has been deprecated/removed from web3.js in 1.0.

Pre 1.0 docs: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3isconnected

Missing from 1.0-beta docs: http://web3js.readthedocs.io/en/1.0/web3.html

  • 2
    so any idea what the new method to check a connection is? they just removed this critical startup function without any re-direction or "deprecated use XXX". nice job.
    – dcsan
    Oct 26, 2019 at 22:17

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.