2020-05-18

开发以太坊过程中遇到的问题

1.后台已启动了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 ()
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.: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)
问题为:账户的地址找不到

2.ipfs安装成功并启动
输入http://127.0.0.1:5001/webui显示网络无法访问

3.安装ipfs-api
sudo npm install ipfs-api
或者sudo npm install ipfs-http-client
出现如下错误:
jiaorj@jiaorj-virtual-machine:/ubuntu-share/ubuntu1/ebay_dapp/app$ sudo npm install ipfs-http-client

[email protected] 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: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] install: node build.js > index.browser.js
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] 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
问题解决,参考:https://www.cnblogs.com/jasonLiu2018/p/11987328.html
经过面向搜索引擎开发,有提到用sudo,但是发现还是不行,实际原因是由于用的是root账户权限执行npm,而npm默认是不适用root权限创建内容,因此会出现权限问题而导致失败,加上参数--unsafe-perm=true --allow-root即可解决问题。
即输入命令:sudo npm install ipfs-http-client --unsafe-perm=true --allow-root解决

安装ipfs-http-client成功.PNG

问题未解决!记录一下!

你可能感兴趣的:(2020-05-18)