【发布时间】:2017-07-01 01:39:18
【问题描述】:
我现在正在学习一个 Solidity 教程,但我在运行 truffle migrate 时遇到了一个错误。此外,testrpc 正在另一个终端选项卡中运行,因此此问题与此处的其他问题无关。
我运行 truffle init,然后将我的 HelloWorld.sol 智能合约添加到 contracts 文件夹中。
pragma solidity ^0.4.11;
contract HelloWorld {
uint public balance;
function HelloWorld(){
balance = 1000;
}
}
然后我运行 truffle compile 一切正常
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/HelloWorld.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Writing artifacts to ./build/contracts
然后我将以下内容添加到我的 2_deploy_contracts.js 迁移文件中
var HelloWorld = artifacts.require("./HelloWorld.sol");
module.exports = function(deployer) {
deployer.deploy(HelloWorld);
};
但是,当我运行 truffle migrate 时,我收到以下错误:
Error: Cannot find module 'truffle-expect'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:85773:14)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:21:30)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:59914:15)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:21:30)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:201851:15)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:21:30)
我尝试过 npm 安装 truffle-expect,但这似乎也不起作用......有什么想法吗?
【问题讨论】:
标签: migrate ethereum solidity truffle