[FAQ] Truffle Deployer 合约传参问题: Invalid number of parameters for "undefined". Got 0 expected 1!
在使用 `truffle migrate` 时,如果合约的构造函数需要传参,而部署脚本里没有传的时候,就会报这个错。
未传参时:
const Migrations = artifacts.require("Migrations"); module.exports = function(deployer) { deployer.deploy(Migrations); };
第二个位置开始代表第一个参数,以此类推:
const Migrations = artifacts.require("Migrations"); module.exports = function(deployer) { deployer.deploy(Migrations, 'xx'); };
其它:基础矿池
Refer:Truffle还流行吗