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

Default Develop port to match metamask & ganache-cli default port #1579

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/truffle-core/lib/commands/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var command = {
numAddresses
);

var onMissing = function(name) {
var onMissing = function() {
return "**";
};

Expand All @@ -83,7 +83,7 @@ var command = {

var ganacheOptions = {
host: "127.0.0.1",
port: 9545,
port: 8545,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this! If Ganache is already running, then truffle develop will fail to start, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be prudent to error out and let the user know something like "Looks like you already have Ganache running on port 8545. Either change the port or turn off Ganache and try the command again."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point of truffle develop is that it's low friction. That's why we chose 9545 for truffle develop in the first place and 7545 for Ganache UI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnidan but you almost never have both running, and I've spoken with many dapp developers in the community that agree with me on this. You always end up having to change the port in your frontend or elsewhere. They should all be 8545 in my opinion and I'd fight for this one very strongly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnidan in v5/next/develop the current behavior is that truffle develop doesn't clash (out of the box) with ganache-cli or ganacheUI.

on this branch/PR, truffle develop doesn't clash with ganacheUI out of the box, but if ganache-cli is already running and you try to spin up truffle develop, it'll clash and throw an error (because of the timestamped network_id's ganache-cli is given). However, if you spin up truffle develop and then start up ganache-cli, truffle will auto-connect to ganache-cli.

network_id: 4447,
total_accounts: numAddresses,
default_balance_ether: defaultEtherBalance,
Expand Down