開(kāi)發(fā)以太坊過(guò)程中遇到的問(wèn)題
1.后臺(tái)已啟動(dòng)了ganache-cli
truffle(development)> web3.eth.getBalance(web3.eth.accounts[1])
/usr/local/lib/node_modules/truffle/build/cli.bundled.js:212023
throw new Error('Provided address "'+ address +'" is invalid, the capitalization checksum test
failed, or its an indrect IBAN address which can't be converted.');
^
Uncaught:
Error: Provided address "undefined" is invalid, the capitalization checksum test failed, or its an
indrect IBAN address which can't be converted.
at Method.inputAddressFormatter
(/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-
helpers/src/formatters.js:409:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-
method/src/index.js:144:1
at Array.map (<anonymous>)
at Method.formatInput (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-
core-method/src/index.js:142:1)
at Method.toPayload (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-
method/src/index.js:177:1)
at Eth.send [as getBalance]
(/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-method/src/index.js:467:1)
at evalmachine.<anonymous>:0:10
at sigintHandlersWrap (vm.js:274:15)
at Script.runInContext (vm.js:128:14)
at runScript
(/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:222:1)
at Console.interpret
(/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:237:1)
at ReplManager.interpret
(/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/repl.js:129:1)
at bound (domain.js:426:14)
at REPLServer.runBound [as eval] (domain.js:439:12)
at REPLServer.onLine (repl.js:759:10)
at REPLServer.emit (events.js:310:20)
at REPLServer.EventEmitter.emit (domain.js:482:12)
at REPLServer.Interface._onLine (readline.js:322:10)
at REPLServer.Interface._line (readline.js:699:8)
at REPLServer.Interface._ttyWrite (readline.js:1025:14)
at REPLServer.self._ttyWrite (repl.js:836:7)
at ReadStream.onkeypress (readline.js:198:10)
問(wèn)題為:賬戶的地址找不到
2.ipfs安裝成功并啟動(dòng)
輸入http://127.0.0.1:5001/webui顯示網(wǎng)絡(luò)無(wú)法訪問(wèn)
3.安裝ipfs-api
sudo npm install ipfs-api
或者sudo npm install ipfs-http-client
出現(xiàn)如下錯(cuò)誤:
jiaorj@jiaorj-virtual-machine:/ubuntu-share/ubuntu1/ebay_dapp/app$ sudo npm install ipfs-http-client
iso-constants@0.1.2 install /ubuntu-share/ubuntu1/ebay_dapp/app/node_modules/iso-constants
node build.js > index.browser.js
sh: 1: cannot create index.browser.js: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! iso-constants@0.1.2 install: node build.js > index.browser.js
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the iso-constants@0.1.2 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/jiaorj/.npm/_logs/2020-05-18T07_09_37_890Z-debug.log
問(wèn)題解決,參考:https://www.cnblogs.com/jasonLiu2018/p/11987328.html
經(jīng)過(guò)面向搜索引擎開(kāi)發(fā),有提到用sudo,但是發(fā)現(xiàn)還是不行,實(shí)際原因是由于用的是root賬戶權(quán)限執(zhí)行npm,而npm默認(rèn)是不適用root權(quán)限創(chuàng)建內(nèi)容,因此會(huì)出現(xiàn)權(quán)限問(wèn)題而導(dǎo)致失敗,加上參數(shù)--unsafe-perm=true --allow-root即可解決問(wèn)題。
即輸入命令:sudo npm install ipfs-http-client --unsafe-perm=true --allow-root解決
問(wèn)題未解決!記錄一下!