Running truffle migrate produces error
deployer.exec command to migration jobsmodule.exports = function(deployer) {
deployer.exec('path/to/script');
}
truffle migrateScript runs and exits successfully
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Expected parameter 'contracts_build_directory' not passed to function.
at /Users/teddy/Projects/btl/truffle-webpack-demo-clone/node_modules/truffle/lib/expect.js:5:15
at Array.forEach (native)
at Object.options (/Users/teddy/Projects/btl/truffle-webpack-demo-clone/node_modules/truffle/lib/expect.js:3:19)
at Object.exec (/Users/teddy/Projects/btl/truffle-webpack-demo-clone/node_modules/truffle/lib/require.js:89:12)
at /Users/teddy/Projects/btl/truffle-webpack-demo-clone/node_modules/truffle/lib/deployer.js:101:17
at /Users/teddy/Projects/btl/truffle-webpack-demo-clone/node_modules/truffle/lib/deployer.js:100:14
at /Users/teddy/Projects/btl/truffle-webpack-demo-clone/node_modules/truffle/lib/deferredchain.js:20:15
I get the following error on a brand new project:
truffle migrate
Error: Invalid JSON RPC response: "Error: connect ECONNREFUSED 127.0.0.1:8545\n at Object.exports._errnoException (util.js:1022:11)\n at exports._exceptionWithHostPort (util.js:1045:20)\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)"
at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
at exports.XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:111:32)
at exports.XMLHttpRequest.dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
I assume it is due to not running the correct server in the background ECONNREFUSED 127.0.0.1:8545 but the error message should be more clear that this is the case and not just error with invalid JSON RPC response. That is way too cryptic! Cheers!
Ie. catch the error when trying to connect to server and rethrow a more "human" error message!
Thanks :)
I've submitted a fix for this issue in #311.
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/usr/local/node/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
at XMLHttpRequest.request.onreadystatechange (/usr/local/node/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:115:32)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/node/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/usr/local/node/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpRequestError (/usr/local/node/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:544:12)
at ClientRequest.
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:309:9)
at emitOne (events.js:96:13)
The deployer.exec() command is no longer available in Truffle 4.0 due to complexities in implementation. You can get around this by writing a module that accepts the deployer and associated contract abstractions as input to a function, and then importing that module into your migrations.
Closing this ticket for housekeeping. Please open a ticket if you run into any more issues. Thanks!
Most helpful comment
Error: Invalid JSON RPC response: "" (/usr/local/node/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:414:24)
at Object.InvalidResponse (/usr/local/node/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
at XMLHttpRequest.request.onreadystatechange (/usr/local/node/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:115:32)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/node/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/usr/local/node/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpRequestError (/usr/local/node/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:544:12)
at ClientRequest.
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:309:9)
at emitOne (events.js:96:13)