-
Notifications
You must be signed in to change notification settings - Fork 2.3k
'truffle compile' doesn't work properly when using multiple network providers. #962
Comments
truffle compile
doesn't work properly
Will check this out in few minutes (on a train) but our CI is passing and have manually verified that commands are completing ok on MetaCoin. Why is it working in one folder for you and not in another? |
@gerchicov-bp I'm getting your project to compile ok after wrapping the wallet providers in functions, as suggested by the docs here. Have only tried with the truffle.js module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*" // Match any network id
},
/*},
development: {
host: "<custom-host>",
port: 8545,
network_id: "*"
},*/
rinkeby: {
provider: function() {
return new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/<infura-key>");
},
gas: 4500000,
gasPrice: 25000000000,
network_id: 4
},
ropsten: {
provider: function() {
new HDWalletProvider(mnemonic, "https://ropsten.infura.io/<infura-key>");
},
gas: 4500000,
gasPrice: 25000000000,
network_id: 3
}
}
}; Output gerchicov user$ truffle version
Truffle v4.1.11 (core: 4.1.11)
Solidity v0.4.24 (solc-js)
gewecke:gerchicov user$ truffle compile
Compiling ./contracts/ClientReceipt.sol...
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/Simple.sol...
Compilation warnings encountered:
/gerchicov/contracts/Migrations.sol:11:3: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
function Migrations() public {
^ (Relevant source part starts here and spans across multiple lines).
,/gerchicov/contracts/Simple.sol:6:3: Warning: No visibility specified. Defaulting to "public".
function getA() constant returns (uint256) {
^ (Relevant source part starts here and spans across multiple lines).
,/gerchicov/contracts/Simple.sol:10:3: Warning: No visibility specified. Defaulting to "public".
function setA(uint256 newValue) {
^ (Relevant source part starts here and spans across multiple lines).
Writing artifacts to ./build/contracts
gerchicov user$ |
@cgewecke Yes, your code works. BUT: |
|
Thanks @cgewecke, for me that was the missing part. As soon as I switched to the "function" form, the issue got resolved.
const path = require("path");
const HDWalletProvider = require("truffle-hdwallet-provider");
module.exports = {
contracts_build_directory: path.join(process.cwd(), "src/Contracts"),
networks: {
mainnet: {
provider: () => new HDWalletProvider(mnemonic, "https://mainnet.infura.io/<infura-key>"),
network_id: 1
},
rinkeby: {
provider: () => new HDWalletProvider(, "https://rinkeby.infura.io/<infura-key>"),
network_id: 4
}
}
}; |
@gerchicov-bp Thanks for opening this - have amended the docs to remove the non-function closure examples. Closing. |
Issue
Used truffle 4.1.8 and everything was ok. Updated to the latest (4.1.11). Now it seems it compiles the contracts but I must cancel/stop it manually. Here is my folder:
http://dropmefiles.com/7dHdO
In the same time tried to compile contracts in another folder - it compiles them successfully.
Steps to Reproduce
Unzip the folder from this link and run
truffle compile
.Expected Behavior
Compiling process is finished successfully
Actual Results
It seems that contracts are compiled but I see
Writing artifacts to ./build/contracts
infinitely.Environment
truffle version
): 4.1.11node --version
): v9.9.0npm --version
): 6.0.1The text was updated successfully, but these errors were encountered: