1

I am trying to build a React app with Truffle. Firstly, my file structure is like so, with root_dir being the project root directory:

root_dir/node_modules/src/libs/truffle

All of truffle's files, including contracts, are in that truffle directory. Everything works normally if I migrate to a local ganache rpc, but if I try to use HDWalletProvider locally or with Ropsten, the following happens:

usr@machine:~/.../root_dir/$ npm run migrate

> project@0.1.0 migrate /home/.../root_dir/
> cd ./src/libs/truffle/ && truffle migrate --network development --reset       
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

usr@machine:~/.../root_dir/$

My truffle-config looks like this:

require("./../../../node_modules/dotenv").config();
const HDWalletProvider = require("./../../../node_modules/truffle-hdwallet-provider");

module.exports = {
    compilers: {
        solc: { 
            version: "0.5.6",
            optimizer: {
                enabled: true,
                runs: 200,
            }
        }
    },
    networks: {
        development: {
            provider: function() { return new HDWalletProvider(process.env.MNEMONIC, "localhost:8545") },
            network_id: "*",
        },
        ropsten: {
            provider: function() { return  new HDWalletProvider(
                process.env.MNEMONIC,
                'https://ropsten.infura.io/v3/${process.env.INFURA_API_KEY}'
            )},
            gasPrice: 4000000000,
            network_id: 3,
        }
    }, 
}

I am on node 10.15.3, truffle 5.0.8, and solc 0.5.6. I cannot figure out how to get past this issue as there are no throws & debug output. Thanks!

  • I tried putting all of the truffle files into root_dir and the behavior is unchanged – Jack Gilcrest Mar 21 at 2:34
1

I think it has to do with your folder permissions. Did you by any chance run sudo npm install truffle-hdwallet-provider? (sudo is the culprit here)

I was struggling with exactly the same issue, so out of frustration, I made a new project folder, run truffle init and npm install truffle-hdwallet-provider, copied my contracts and configuration files to the new folder, and the deployment to Ropsten worked just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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