I'm using macOS High Sierra. I installed truffle and ganache-cli as below
npm install -g truffle
npm install -g ganache-cli
Then I created a directory and cd to it to run the test
mkdir ethereumTest
cd ethereumTest
I initiate the truffle and compile it
truffle init
truffle compile
Since I'm on Mac, I changed the truffle.js
file as below
module.exports = {
network: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*"
}
}
};
I opened another terminal and ran ganache-cli ganache-cli
But when I tried to migrate to the network in the previous terminal, it gives error
truffle migrate
It gives
Unknown network "[object Object]". See your Truffle configuration file for available networks.
truffle network --network development
It gives
Unknown network "development". See your Truffle configuration file for available networks.
I also tried the following
- remove
truffle-config.js
- change
truffle-config.js
as the same astruffle.js
- In the
truffle.js
file, changehost
tolocalhost
But none of them works, any other suggestion?
truffle network
??? I think what you mean istruffle migrate
.truffle-config.js
andtruffle.js
are the same, you only need one of them (on Windows, callingtruffle
might lead to a "collision" withtruffle.js
, so better usetruffle-config.js
, but you're not even using Windows).ganache-cli
before migrating? also, what do you get withtruffle develop
?truffle develop
givesTruffle Develop started at http://127.0.0.1:9545/
, but in the ganache-cli, the port is indeed 8545 instead of 9545