I read other questions like this here but none solved my issue. I have a terminal window on which I ran
geth --networkid=4 --rpc --rpcport 8545 --datadir=$HOME/.rinkeby --syncmode=light --ethstats='yournode:Respect my [email protected]' --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc512[email protected]:30303?discport=30304
based on the connect yourself section of the test chain Rinkeby.
I also have a node app which has
var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
and which I'm running after launching geth.
The terminal launches geth with no issues and outputs
INFO [07-12|15:40:40] HTTP endpoint opened: http://127.0.0.1:8545. I don't understand why my node app is having trouble connecting to it.
The error is
ReferenceError: web3 is not defined.