'network id specified in truffle config does not match the one returned by network
I'm trying to run a truffle test on ganache-cli and it keeps saying the network ids do not match even though in my truffle-config.js file I specified the id to be 5777 not 4447
Error: The network id specified in the truffle config (4447) does not match the one returned by the network (5777). Ensure that both the network and the provider are properly configured.
at Object.detectAndSetNetworkId (/Users/rbeit/.npm-global/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/environment.js:94:1)
at processTicksAndRejections (internal/process/task_queues.js:89:5)
at Object.detect (/Users/rbeit/.npm-global/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/environment.js:22:1)
at Object.develop (/Users/rbeit/.npm-global/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/environment.js:71:1)
Truffle v5.0.21 (core: 5.0.21)
Node v12.3.1
Solution 1:[1]
!Vande Maataram!
You must have cloned the project directly from the github repository (https://github.com/aelshayeb/blockchain) and started compiling and running this .... try this ... just do it.
->npm uninstall truffle -g
->npm install truffle -g (this and the previous ensures running the most current version, now 5.0.4)
->mkdir metacoin
->cd metacoin
->truffle unbox metacoin (try this)
now open the truffle-config.js in the meta coin folder and uncomment the truffle-config.js: "default values".
now you can use: *truffle compile, *truffle migrate, *truffle test; but, first check the following things: 1. your blockchain network_id is same as reffered in the truffle-config.js. 2. if you run on private net so, check the hostIP and portnumber and network_id before you set start.
Go on Enjoy Coding!! ||Krinavantovishwamaryam||
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Paarth Aazaad Bhaarati |