Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Truffle cannot use ganache app #4188

Closed
1 task done
Aragar199 opened this issue Jul 15, 2021 · 2 comments
Closed
1 task done

Truffle cannot use ganache app #4188

Aragar199 opened this issue Jul 15, 2021 · 2 comments

Comments

@Aragar199
Copy link

Aragar199 commented Jul 15, 2021


Issue

If you try to use the Ganache UI (not ganache-cli) on its default port of 7545, and truffle develop at the same time, develop indicates that it is connected to a ganache instance at port 9545, even though there is no instance of ganache running at that port. Then when you run test, Truffle throws a Provider Error because it can't connect.

Steps to Reproduce

  1. Start Ganache UI, note the port by default is 7545
  2. Run truffle develop in a Truffle project, observe it says that develop is connected to port 9545
  3. Run test
  4. Observe error

Expected Behavior

For truffle develop to spin up a new ganache instance at 9545, the default develop port, and run tests against that instance. Or, in the alternative, for develop to connect to the ganache ui running at port 7545, and indicate that this is the case.

Actual Results

run truffle develop, then run test.

The error:

ProviderError: 
Could not connect to your Ethereum client with the following parameters:
    - host       > 127.0.0.1
    - port       > 7545
    - network_id > 5777
Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle-config.js)

      at /usr/local/lib/node_modules/truffle/build/webpack:/packages/provider/wrapper.js:73:1
      at /usr/local/lib/node_modules/truffle/build/webpack:/packages/provider/wrapper.js:102:1
      at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3/node_modules/web3-providers-http/lib/index.js:98:1)
      at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:1)
      at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:208:1)
      at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._onHttpRequestError (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:349:1)
      at ClientRequest.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:252:47)
      at Socket.socketOnEnd (_http_client.js:458:9)
      at endReadableNT (_stream_readable.js:1241:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)

Environment

  • Operating System: macOS Big Sur v11.4
  • Truffle v5.4.0 (core: 5.4.0)
  • Solidity - ^0.6.2 (solc-js)
  • Node v12.22.1
  • Web3.js v1.4.0
@eggplantzzz
Copy link
Contributor

Hey @Aragar199! When you use truffle develop, Truffle internally spins up its own version of Ganache and uses that. If you want to connect to Ganache UI you should use truffle console --network <networkName> where <networkName> is the name of a network you have configured in your truffle-config.js.

Incidentally, I don't get an error when I follow your steps above. Maybe you have some other things running at those ports somehow? If you restart your computer and try again, do you still get the error?

@Aragar199
Copy link
Author

No, I don't get the error after restarting. Thanks! Closing the ticket.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants