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.jsas the same astruffle.js - In the
truffle.jsfile, changehosttolocalhost
But none of them works, any other suggestion?
truffle network??? I think what you mean istruffle migrate. – goodvibration Jul 21 '18 at 16:12truffle-config.jsandtruffle.jsare the same, you only need one of them (on Windows, callingtrufflemight lead to a "collision" withtruffle.js, so better usetruffle-config.js, but you're not even using Windows). – goodvibration Jul 21 '18 at 18:39ganache-clibefore migrating? also, what do you get withtruffle develop? – n1cK Jul 21 '18 at 18:58truffle developgivesTruffle Develop started at http://127.0.0.1:9545/, but in the ganache-cli, the port is indeed 8545 instead of 9545 – ycenycute Jul 21 '18 at 19:19truffle migrate? Keep only one oftruffle.jsortruffle-config.jsnot both. – Ismael Jul 24 '18 at 01:59Ganache CLI v6.1.6 (ganache-core: 2.1.5). I believe I'm in the correct directory. And I did try remove one of them, but still did not work. – ycenycute Jul 25 '18 at 02:35