I used truffle unbox react to download the starter repo on my Windows 10 pc. I can run testrpc, truffle compile, and truffle migrate without any compilation errors. When I run the code in my browser a number value doesn't change (which it should if the contracts are working) and I get a console error: "Uncaught (in promise) Error: SimpleStorage has not been deployed to detected network (network/artifact mismatch)". Truffle test seems to work fine.

1 Answer 1


For me, the problem was with MetaMask in my browser. MetaMask seems to be providing web3.js (the Ethereum JS API). Web3 is called upon by your Truffle code. In this case, in the function detectNetwork (in /node_modules/truffle-contract/contract.js) web3 is used to discover your network id (the Ethereum network): web3.version.getNetwork(...).

You must therefore make sure the network MetaMask is using is the same as the local network you are hosting (testrpc / ganache etc.).

You can click on MetaMask in your browser, and in the top left select the network and choose "Localhost port_number" as the Ethereum network you would like to use. Then refresh your Truffle app and it should successfully find the correct network ID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.