我正在使用Ganache。我开箱了宠物商店。然后在合同文件夹中,制作了一个文件Election.sol
,其中包含代码
pragma solidity ^0.5.8;
contract Election{
string public candidate;
constructor() public{
candidate = "candidate 1"; //state var
}
}
然后在migrations文件夹中,制作了2_deploy_contract.js
,其中包含代码
var Election = artifacts.require("./Election.sol");
module.exports = function(deployer) {
deployer.deploy(Election );
};
当我使用命令-truffle migrate
进行松露迁移时,会出现此错误。
Compiling your contracts...
Everything is up to date, there is nothing to compile.
Migrations dry-run (simulation)
Network name: 'development-fork' Network id: 1 Block gas limit: 0x1388
1_initial_migration.js
Deploying 'Migrations'
Error: Error: Error: * Deployment Failed *
"Migrations" ran out of gas (using Truffle's estimate.) * Block limit: 0x50e7c * Gas sent: undefined * Try: + Setting a higher gas estimate multiplier for this contract + Using the solc optimizer settings in 'truffle-config.js' + Making your contract smaller + Making your contract constructor more efficient + Setting a higher network block limit if you are on a private network or test client (like ganache).
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
我已经看到一些解决类似问题的解决方案,但是它不能解决我的问题。