Deploying smart contracts with truffle and geth in windows

I'm trying to deploy a contract. When running: truffle.cmd migrate network --ropsten I get the following error:

No network specified. Cannot determine current network.

I've connected & unlocked my account in geth with: geth --fast --cache=1048 --testnet --unlock "mycontractaddress" --rpc --rpcapi "eth,net,web3" --rpccorsdomain '' --rpcaddr localhost --rpcport 8545 Previously, I have synced with the entire blockchain*

My truffle.js file is:

module.exports = {
networks: {
localhost: {
host: "localhost",
port: 8545,
network_id: "*"
},
ropsten: {
host: "localhost",
port: 8545,
network_id: "3"
}
}
};

• Did you try truffle.cmd migrate --network ropsten? – ivicaa Feb 21 '18 at 22:55
• @ivicaa can you add this as an answer? This post shows up in the review queue and as unanswered, and you're dead on the money that this is the right solution. – hakusaro Feb 21 '18 at 23:22
• yes, that's the exact command I used. Please see the first paragraph of my question. Am I missing something? – CryptoQueen Feb 21 '18 at 23:57

truffle.cmd migrate network --ropsten

should be

truffle.cmd migrate --network ropsten

With truffle.cmd networks you can check which networks are available from your truffle.js.

• That solved one of the problems for sure, thanks! Still can't deploy. I get the following error: Running migration: 1_initial_migration.js Deploying Migrations... ... undefined Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: exceeds block gas limit at Object.InvalidResponse (C:\Users\username\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1) – CryptoQueen Feb 23 '18 at 18:09
• I also created a new migrations file for the contract I'm trying to deploy using the same format as the 1_initial_migration contract that was auto created. I wrote the following code: var Migrations = artifacts.require("./Migrations.sol"); module.exports = function(deployer) { deployer.deploy(Migrations); }; – CryptoQueen Feb 23 '18 at 18:11
• Try to add the "gas" property to your truffle.js. Something with 5000000 or more. It seems like the default value for the gas limit is not high enough. – ivicaa Feb 23 '18 at 18:47
• I did and now I'm getting a syntax error about gas. Is this the correct truffle.js syntax? Also, do I need to include the development network in the code? module.exports = { networks: { localhost: { host: "localhost", port: 8545, network_id: "*" gas: 500000 } ropsten: { host: "localhost", port: 8545, network_id: "3" gas: 500000 } } } – CryptoQueen Feb 23 '18 at 21:40
• You‘re missing a comma in front of gas and also one more 0. Should be 5Mil. – ivicaa Feb 23 '18 at 22:51