Blockchain 块菌错误:错误:处理事务时VM异常:还原

Blockchain 块菌错误:错误:处理事务时VM异常:还原,blockchain,ethereum,truffle,Blockchain,Ethereum,Truffle,我在用块菌: truffle(development)> var hw undefined truffle(development)> HelloWorld.deployed().then(function(deployed){hw=deployed;}); undefined truffle(development)> hw.SayHello.call() 我的块菌含量低于错误值 ***Error: VM Exception while processing t

我在用块菌:

truffle(development)> var hw  
undefined 
truffle(development)> HelloWorld.deployed().then(function(deployed){hw=deployed;}); 
undefined 
truffle(development)> hw.SayHello.call() 
我的块菌含量低于错误值

***Error: VM Exception while processing transaction: revert 
    at Object.InvalidResponse (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:41484:16) 
    at C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:328866:36 
    at C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:324536:9 
    at XMLHttpRequest.request.onreadystatechange (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:327565:7) 
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176407:18)  
    at XMLHttpRequest._setReadyState (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176697:12) 
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176852:12) 
    at IncomingMessage.<anonymous> (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176812:24) 
    at emitNone (events.js:111:20) 
    at IncomingMessage.emit (events.js:208:7) ***
2)My 2_deploy_contracts.js

var ConvertLib = artifacts.require("./ConvertLib.sol");
var MetaCoin = artifacts.require("./MetaCoin.sol");
var HelloWorld = artifacts.require("./HelloWorld.sol");
var second = artifacts.require("./second.sol");

module.exports = function(deployer) { 
  deployer.deploy(ConvertLib);
  deployer.link(ConvertLib, MetaCoin); 
  deployer.deploy(MetaCoin); 
  deployer.deploy(HelloWorld);
  deployer.deploy(second);
}; 
module.exports = { 
  networks: { 
    development: { 
      host: "localhost", 
      port: 8545, 
      network_id: "*" // Match any network id 
    } 
  } 
};
3)我的块菌.js

var ConvertLib = artifacts.require("./ConvertLib.sol");
var MetaCoin = artifacts.require("./MetaCoin.sol");
var HelloWorld = artifacts.require("./HelloWorld.sol");
var second = artifacts.require("./second.sol");

module.exports = function(deployer) { 
  deployer.deploy(ConvertLib);
  deployer.link(ConvertLib, MetaCoin); 
  deployer.deploy(MetaCoin); 
  deployer.deploy(HelloWorld);
  deployer.deploy(second);
}; 
module.exports = { 
  networks: { 
    development: { 
      host: "localhost", 
      port: 8545, 
      network_id: "*" // Match any network id 
    } 
  } 
};
请让我知道如何修复上述错误


`

我刚刚运行了您的示例,效果很好。我所做的唯一更改是从2_deploy_契约中删除了其他未使用的智能契约。在启动块菌控制台之前,确保正在运行
compile
migrate
命令,并且
testrpc
正在运行。另外,为了防止您在Windows上运行,请将
truffle.js
重命名为
truffle config.js

$ truffle compile 
Compiling .\contracts\HelloWorld.sol... 
Writing artifacts to .\build\contracts

$ truffle migrate 
Using network 'development'.

Running migration: 2_deploy_contracts.js   
Deploying HelloWorld...   
... 0xef7e895758805a3c3c9aaed7dc7c97fe7b2278b0c0d6ee8105192183a86188c9 
HelloWorld: 0x54329ff919efda7920408084590d7480a6c88243 
Saving successful migration to network...   
... 0x0954625bf66275469c9475ca21f5db20bc4667efb716c5e19bfd98a9553f4a83 
Saving artifacts...

$ truffle console 
truffle(development)> var hw 
undefined 
truffle(development)> HelloWorld.deployed().then(function(deployed){hw=deployed;}); 
undefined 
truffle(development)> hw.SayHello.call() 
'SomeHello' 
truffle(development)>
2_deploy_contracts.js

var HelloWorld = artifacts.require("./HelloWorld.sol");

module.exports = function(deployer) {   deployer.deploy(HelloWorld); };