刘月林 | Invalid JSON RPC response: undefined, when running web3.eth.accounts (Node)

I'm very new Ethereum and trying to follow this tutorial:
https://www.zastrin.com/courses/simple-voting-vid/lessons/3-4

But when I run:
deployedContract = VotingContract.new(['Rama','Nick','Jose'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})

I get an error:


屏幕快照 2018-07-18 下午4.32.50.png

Solution:
Install web3 and testrpc packages: npm install ethereumjs-testrpc [email protected] In the same terminal window, run testrpc:
node_modules/.bin/testrpc Open a NEW terminal window (with the first one still open and running), and run node :

deployedContract = VotingContract.new(['Rama','Nick','Jose'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})


环境配置2.gif

Finally, succeeded!

刘月林
写于湖北沙洋
2018/07/18

你可能感兴趣的:(刘月林 | Invalid JSON RPC response: undefined, when running web3.eth.accounts (Node))