I've cloned testrpc and have it running in a separate directory. It's set to the default localhost:8545. I've successfully installed truffle and ran truffle-init-webpack, then truffle compile. When I try and migrate my contracts to the testrpc, i get the following error

Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\web3\lib\web3\errors.js:35:16)
    at XMLHttpRequest.request.onreadystatechange (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\web3\lib\web3\httpprovider.js:115:32)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:354:12)
    at XMLHttpRequest._onHttpRequestError (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:544:12)
    at ClientRequest.<anonymous> (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:414:24)
    at emitOne (events.js:115:13)
    at ClientRequest.emit (events.js:210:7)
    at Socket.socketErrorListener (_http_client.js:399:9)
    at emitOne (events.js:115:13)

I've checked my truffle.js file and it seems to be correct:


module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*' // Match any network id

Any idea's why this would be happening would be greatly appreciated.

Edit: I'm on Windows 10, I'm using node 8.1.0 and Truffle 3.2.1

  • Is is possible your contract constructor throws for some reason? – Rob Hitchens - B9lab Jun 25 '17 at 22:21
  • What does testrpc show in its console? Check there is no geth instance running in port 8545. – Ismael Jun 25 '17 at 22:24
  • @Rob The contracts that I'm using can be found in the repo here: github.com/tomw1808/truffle_eth_class2/tree/master/s06/… I checked in the browser IDE and there appears to be no errors being thrown from the constructor. Ismael, no instances of geth were running, only the testrpc :-\ – imcz Jun 25 '17 at 22:49
  • Nothing comes up in the testrpc console... – imcz Jun 25 '17 at 23:00
  • Update! I restarted my machine, ran truffle migrate and it's working now. Thanks for taking the time to help :-) – imcz Jun 25 '17 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.