https://www.npmjs.com/package/truffle/tutorial有坑
填坑:
1.https://ethereum.stackexchange.com/questions/18787/testrpc-installation-on-ubuntu-14-04-is-failing
2.https://askubuntu.com/questions/562417/how-do-you-update-npm-to-the-latest-version
3.https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
安装npm的命令执行twice才能安装到最新version
安装truffle步骤:
安装npm sudo apt-get install npm(not the latest version)
更新npm到latest version:执行sudo apt-get install -g npm(还要执行两次的呀)
安装
truffle migrate问题报错
truffle执行过程
truffle init //下载文档目录到本地
truffle compile//在把.sol文件放到contracts目录下后执行编译命令,每次编译都是编译最新变化过的文件,以减少编译工作量。可以用-all来覆盖编译
truffle migrate
错误 缺";" ——compile error
SyntaxError: Expected "contract", "import", "library", "pragma", "using", comment, end of input, end of line, or whitespace but "s" found.
at peg$buildStructuredError (/usr/lib/node_modules/truffle/build/cli.bundled.js:174912:12)
at Object.peg$parse [as parse] (/usr/lib/node_modules/truffle/build/cli.bundled.js:178511:11)
at Object.parse (/usr/lib/node_modules/truffle/build/cli.bundled.js:80654:23)
at /usr/lib/node_modules/truffle/build/cli.bundled.js:46466:36
at /usr/lib/node_modules/truffle/build/cli.bundled.js:31907:5
at /usr/lib/node_modules/truffle/build/cli.bundled.js:53448:16
at next (/usr/lib/node_modules/truffle/build/cli.bundled.js:63382:18)
at /usr/lib/node_modules/truffle/build/cli.bundled.js:31892:7
at /usr/lib/node_modules/truffle/build/cli.bundled.js:85971:5
at /usr/lib/node_modules/truffle/build/cli.bundled.js:63287:16
错误类型 ——migate error
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)
解决办法之一:
1) Run the following command:
npm install -g truffle-expect truffle-config web3
2) Run
testrpc
in another shell instance
3) Run
truffle migrate
in your truffle project directory
var HelloWorld = artifacts.require("./HelloWorld.sol");
错误类型 缺变量var ——migate error