执行 truffle.migrate 时出错,"undefined" 的参数数量无效

An error when executing truffle.migrate, Invalid number of parameters for "undefined"

我正在尝试部署智能合约:

`
pragma solidity >=0.4.21;

contract SimpleStorage {
uint public storedData;

constructor(uint initVal) public {
storedData = initVal;
}

function set(uint x) public {
storedData = x;
}

function get() view public returns (uint retVal) {
return storedData;
}
}`

我创建了2_deploy.js

var SimpleStorage = artifacts.require("SimpleStorage");

module.exports = function(deployer) {
// Pass 42 to the contract as the first constructor parameter
deployer.deploy(SimpleStorage, 42, {privateFor: 
["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]})
};

但是当我执行 truffle.migration 时,我得到了这个错误:

 'Error encountered, bailing. Network state unknown. Review 
 successful transactions manually.
  Error: Invalid number of parameters for "undefined". Got 2 
  expected 1!
at Object.InvalidNumberOfParams 
 (/usr/lib/node_modules/truffle/build/webpack:/~/web3-eth- 
contract/~/web3-core-helpers/src/errors.js:32:1)
at Object._createTxObject 
(/usr/lib/node_modules/truffle/build/webpack:/~/web3-eth- 
contract/src/index.js:699:1)
 at Contract.deploy 
(/usr/lib/node_modules/truffle/build/webpack:/~/web3-eth- 
contract/src/index.js:504:1)
at Function.deploy 
(/usr/lib/node_modules/truffle/build/webpack:/packages/truffle- 
contract/lib/execute.js:214:1)
at constructor.detectNetwork.then.network 
(/usr/lib/node_modules/truffle/build/webpack:/packages/truffle- 
contract/lib/contract/constructorMethods.js:56:1)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)        
Truffle v5.0.13 (core: 5.0.13)
Node v8.9.4''

有人知道如何处理这个问题吗?

Truffle 最近才添加了对仲裁私有事务的支持。所以你需要 Truffle 版本 5.0.14。 希望对您有所帮助。