samwen@samwen-ubuntu:~/VToken$ truffle -v Truffle v5.0.24 - a development framework for Ethereum
Usage: truffle <command> [options]
Commands: build Execute build pipeline (if configuration present) compile Compile contract source files config Set user-level configuration options console Run a console with contract abstractions and commands available create Helper to create new contracts, migrations and tests debug Interactively debug any transaction on the blockchain (experimental) deploy (aliasfor migrate) develop Open a console with a local development blockchain exec Execute a JS module within this Truffle environment help List all commands or provide information about a specific command init Initialize new and empty Ethereum project install Install a package from the Ethereum Package Registry migrate Run migrations to deploy contracts networks Show addresses for deployed contracts on each network obtain Fetch and cache a specified compiler opcode Print the compiled opcodes for a given contract publish Publish a package to the Ethereum Package Registry run Run a third-party command test Run JavaScript and Solidity tests unbox Download a Truffle Box, a pre-built Truffle project version Show version number and exit watch Watch filesystem for changes and rebuild the project automatically
samwen@samwen-ubuntu:~/VToken$ truffle deploy --reset --network ropsten Compiling your contracts... =========================== > Everything is up to date, there is nothing to compile.
1_initial_migration.js ====================== Error: Invalid JSON RPC response: "" at Object.InvalidResponse (/home/samwen/VToken/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/tyler/projects/truffle/node_modules/web3-providers-http/node_modules/web3-core-helpers/src/errors.js:42:1) at e.InvalidResponse [as onreadystatechange] (/home/samwen/VToken/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/tyler/projects/truffle/node_modules/web3-providers-http/src/index.js:92:1) at e._a [as dispatchEvent] (/home/samwen/VToken/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/tyler/projects/truffle/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:27:61) at e.dispatchEvent [as _setReadyState] (/home/samwen/VToken/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/tyler/projects/truffle/node_modules/xhr2-cookies/dist/xml-http-request.js:208:1) at e._setReadyState [as _onHttpRequestError] (/home/samwen/VToken/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/tyler/projects/truffle/node_modules/xhr2-cookies/dist/xml-http-request.js:349:1) at ClientRequest._onHttpRequestError (/home/samwen/VToken/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/tyler/projects/truffle/node_modules/xhr2-cookies/dist/xml-http-request.js:252:47) at ClientRequest.emit (events.js:198:13) at TLSSocket.socketErrorListener (_http_client.js:392:9) at TLSSocket.emit (events.js:198:13) at emitErrorNT (internal/streams/destroy.js:91:8) at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) at process._tickCallback (internal/process/next_tick.js:63:19)
Deploying 'Migrations' ---------------------- > block number: 5878867 > block timestamp: 1561706914 > account: 0xAFEbF61AF27866a27D839f47CfBef7dd415bAB65 > balance: 1.99475076 > gas used: 262462 > gas price: 20 gwei > value sent: 0 ETH > total cost: 0.00524924 ETH
------------------------------------- > Total cost: 0.00524924 ETH
2_deploy_contracts.js =====================
Deploying 'VToken' ------------------ > block number: 5878869 > block timestamp: 1561706947 > account: 0xAFEbF61AF27866a27D839f47CfBef7dd415bAB65 > balance: 1.96577714 > gas used: 1421673 > gas price: 20 gwei > value sent: 0 ETH > total cost: 0.02843346 ETH
------------------------------------- > Total cost: 0.02843346 ETH
Summary ======= > Total deployments: 2 > Final cost: 0.0336827 ETH
"Migrations" could not deploy due to insufficient funds * Account: 0xA495032Bf8c02cC4594a40F53AC5A38555728107 * Balance: 0 wei * Message: insufficient funds for gas * price + value * Message: sender doesn't have enough funds to send tx. The upfront cost is: 134439500000000000 and the sender's account only has: 0 * Try: + Using an adequately funded account + If you are using a local Geth node, verify that your node is synced.
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1) at process._tickCallback (internal/process/next_tick.js:68:7) Truffle v5.0.24 (core: 5.0.24) Node v10.16.0
could not deploy due to insufficient funds : 因资金不足无法部署
"Migrations" exceeded the block limit (with a gas value you set). * Block limit: 0x203c3f0 * Gas sent: 11118500000 * Try: + Sending less gas. + Setting a higher network block limitif you are on a private network or test client (like ganache).
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1) at process._tickCallback (internal/process/next_tick.js:68:7) Truffle v5.0.24 (core: 5.0.24) Node v10.16.0
# 先确认已安装C++编译环境 samwen@samwen-ubuntu:~/VToken$ sudo apt-get install build-essential Reading package lists... Done Building dependency tree Reading state information... Done build-essential is already the newest version (12.4ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. samwen@samwen-ubuntu:~/VToken$ samwen@samwen-ubuntu:~/VToken$ sudo npm install truffle-hdwallet-provider npm WARN deprecated tar.gz@1.0.7: ⚠️ WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir'/home/samwen/VToken/node_modules/scrypt/build' gyp ERR! System Linux 4.15.0-20-generic gyp ERR! command"/usr/local/bin/node""/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js""rebuild" gyp ERR! cwd /home/samwen/VToken/node_modules/scrypt gyp ERR! node -v v10.16.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN VToken@1.0.0 No repository field. npm WARN VToken@1.0.0 No license field.
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! scrypt@6.0.3 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the scrypt@6.0.3 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! /home/samwen/.npm/_logs/2019-06-28T05_50_58_642Z-debug.log
# 重新运行安装一次 samwen@samwen-ubuntu:~/VToken$ sudo npm install truffle-hdwallet-provider npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support npm WARN deprecated tar.gz@1.0.7: ⚠️ WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar npm ERR! path /home/samwen/VToken/node_modules/web3-providers-ws/node_modules/websocket npm ERR! code EISGIT npm ERR! git /home/samwen/VToken/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule. npm ERR! git /home/samwen/VToken/node_modules/web3-providers-ws/node_modules/websocket npm ERR! git Refusing to remove it. Update manually, npm ERR! git or move it out of the way first.
npm ERR! A complete log of this run can be found in: npm ERR! /home/samwen/.npm/_logs/2019-06-28T05_58_55_864Z-debug.log samwen@samwen-ubuntu:~/VToken$ # 提示websocket下有 'git repo or submodule',手动删除 '.git' samwen@samwen-ubuntu:~/VToken$ sudo rm -rf node_modules/web3-providers-ws/node_modules/websocket/.git samwen@samwen-ubuntu:~/VToken$ sudo npm install truffle-hdwallet-provider npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support npm WARN deprecated tar.gz@1.0.7: ⚠️ WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir'/home/samwen/VToken/node_modules/scrypt/build' gyp ERR! System Linux 4.15.0-20-generic gyp ERR! command"/usr/local/bin/node""/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js""rebuild" gyp ERR! cwd /home/samwen/VToken/node_modules/scrypt gyp ERR! node -v v10.16.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN VToken@1.0.0 No repository field. npm WARN VToken@1.0.0 No license field.
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! scrypt@6.0.3 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the scrypt@6.0.3 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! /home/samwen/.npm/_logs/2019-06-28T06_10_26_806Z-debug.log samwen@samwen-ubuntu:~/VToken$ samwen@samwen-ubuntu:~/VToken$ node-gyp rebuild internal/modules/cjs/loader.js:638 throw err; ^
Error: Cannot find module 'graceful-fs' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (/usr/share/node-gyp/lib/node-gyp.js:12:10) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) samwen@samwen-ubuntu:~/VToken$ # 切换到root账号执行,就没有权限问题了。 samwen@samwen-ubuntu:~/VToken$ sudo su root root@samwen-ubuntu:/home/samwen/VToken# sudo npm install truffle-hdwallet-provider npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support npm WARN deprecated tar.gz@1.0.7: ⚠️ WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar