npm ERR! Command failed: git clone --mirror -q https://github.com/frozeman/bignumber.js-nolookahead.git /root/.npm/_cacache/tmp/git-clone-009e0edd/.git
npm ERR! warning: 模版未找到 /tmp/pacote-git-template-tmp/git-clone-9a2d4e6e
npm ERR! fatal: unable to access 'https://github.com/frozeman/bignumber.js-nolookahead.git/': Failed connect to github.com:443; Connection refused
因为用了淘宝的nmp源,然后我又挂了vpn,所以会出错。
FilterSubprovider - no filter with that id: 0xadd9db90f3914bc53b00460206b624a1
启动./node_modules/.bin/ganache-cli,一直在刷这个代码,原因是开了两个nodejs的终端,只保留一个就没了。
{"errors":[{"component":"general","formattedMessage":"* Line 1, Column 1\n Syntax error: value, object or array expected.\n* Line 1, Column 2\n Extra non-whitespace after JSON value.\n","message":"* Line 1, Column 1\n Syntax error: value, object or array expected.\n* Line 1, Column 2\n Extra non-whitespace after JSON value.\n","severity":"error","type":"JSONError"}]}
执行这个solc.compile(source)命令报错,刚开始就怀疑是solc和.sol文件中的版本冲突,但卸载了好几次都没用。后来尝试用去全局卸载,在安装一样的版本,就不报错了。
npm uninstall -g solc
npm uninstall solc
npm install solc@0.4.25
Error: insufficient data for uint128 type (arg="", coderType="uint128", value="0x00")
合约的地址不对。
Fatal: Failed to write genesis block: unsupported fork ordering: eip150Block not enabled, but eip155Block enabled at 0
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
[root@spark1 myChain]# ps -ef | grep geth
查看有geth的进程
geth attach http://localhost:8545
重新进入挂在后台的geth控制台
Error: EACCES: permission denied, open '/root/.config/truffle/config.json' You don't have access to this file.
安装truffle报错,解决:
set HOME_BACKUP=$HOME
export HOME=/tmp/truffle_install
mkdir -p $HOME/.config/truffle
chmod a+rwx $HOME/.config
chmod a+rwx $HOME/.config/truffle # <- install fails with EACCESS (dir doesn't exists)
npm install -g truffle@${TRUFFLE_VERSION} # <- $HOME is ignored. Install in correct path
# /opt/nvm/versions/node/v10.16.3/bin/truffle in my setup
rm -rf $HOME # <- I can remove it once installed. Weird!!!???
set HOME=$HOME_BACKUP
truffle develop报错:
Could not find suitable configuration file.
Truffle v5.1.19 (core: 5.1.19)
Node v10.19.0
解决方法:
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*" // Match any network id
}
}
};
注意账户没有钱只能通过挖矿获得。
GoError: Error: account unlock with HTTP access is forbidden at web3.js:6347:37(47)
geth的时候加这句--allow-insecure-unlock
truffle执行migrate的时候一定要开启挖矿,因为会临时生成一个hash
修改了contract就会报这个错。把build的contract下的文件删除了才行
hijackedStack: 'Error: Returned values aren\'t valid, did it run Out of Gas?\n at ABICoder.decodeParameters
用geth测试时,就报这个错了,但是我用ganache测试时,就没有错。geth用的web3是0.20.1,truffle console中使1.2.1
我用solcjs编译后,用web3j部署可以。据说是solc的版本和geth的版本问题,有人用solc0.5.4和geth1.8.22成功
在使用geth运行私链时,宿主机的metamask连不上该链,查到不要用npm run dev运行,用下面这个命令:
node_modules/webpack-dev-server/bin/webpack-dev-server.js --hot --host 0.0.0.0
虚拟机上运行了ganache,metamask连接不上ganache启动的网络,所以我们在启动ganache的时候加上命令 -h 0.0.0.0,之后就能连接上了(前提是虚拟机添加了端口转发到宿主机)。之后自己的账户余额显示0,因为这是我最初申请的账户,我需要导入ganache给我提供的任意一个账户,上面有100以太。点击下图中的导入,输入私钥。
运行宠物商店案例的时候,发布的时候报错,因为它设置了打开浏览器,但是虚拟机中使命令行界面,所以要设置bs-config.json,新增加一行命令:
遇到了一个很恶心的问题,浪费了很长时间。我重新clone了go-ethreum,但是make all的时候总是报错:
env GO111MODULE=on go run build/ci.go install
go: github.com/Azure/azure-pipeline-go@v0.2.2: Get "https://proxy.golang.org/github.com/%21azure/azure-pipeline-go/@v/v0.2.2.mod": dial tcp 172.217.160.113:443: connect: connection refused
make: *** [all] 错误 1
这是因为go mod 国内被墙了,解决方法:一键解决 go get golang.org/x 包失败 - 格物
执行以下代码,亲测有用:
export GO111MODULE=on
export GOPROXY=https://goproxy.io
共享文件夹挂载后不显示:到/mnt/hgfs目录下执行:vmhgfs-fuse .host:/ /mnt/hgfs 退出来重新进入该目录就可以了。
vim ~/.npmrc 可以删除对npm源的设置。
Error: EACCES: permission denied, scandir '/home/hadoop/project/dapp/node_modules/ganache-cli/node_modules/secp256k1'
(node:6158) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
at errorHandler (/usr/local/node/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
at /usr/local/node/lib/node_modules/npm/bin/npm-cli.js:78:20
at cb (/usr/local/node/lib/node_modules/npm/lib/npm.js:228:22)
at /usr/local/node/lib/node_modules/npm/lib/npm.js:266:24
at /usr/local/node/lib/node_modules/npm/lib/config/core.js:83:7
at Array.forEach (<anonymous>)
at /usr/local/node/lib/node_modules/npm/lib/config/core.js:82:13
at f (/usr/local/node/lib/node_modules/npm/node_modules/once/once.js:25:25)
at /usr/local/node/lib/node_modules/npm/lib/config/core.js:112:20
(node:6158) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6158) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
TypeError: Cannot read property 'loaded' of undefined
at process.<anonymous> (/usr/local/node/lib/node_modules/npm/lib/utils/error-handler.js:40:18)
at process.emit (events.js:182:13)
/usr/local/node/lib/node_modules/npm/lib/utils/error-handler.js:205
if (npm.config.get('json')) {
npm install 报上面这个错,解决方法:chmod 777 该文件夹。这个问题排查了很久,一直不知道什么问题,因为我之前用
chomd 666 执行过,以为权限ok,一直没往这方面想。
全局安装有问题:
Error: Cannot find module '/home/hadoop/project/dapp/root/lib/node_modules/truffle/scripts/postinstall.js'
删除~/.npmrc中的前缀
permission denied, open '/root/.config/truffle/config.json'
jamatulli的回答:https://github.com/trufflesuite/truffle/issues/2217
安装web3j:release中找到包含多个文件的包,下载。有的release只有两个文件source code,用不了。
启动私链的命令:
nohup geth --datadir . --networkid 15 --rpc --rpcapi db,eth,net,web3,personal,miner --rpcport 8545 --rpcaddr 0.0.0.0 --allow-insecure-unlock --nodiscover --rpccorsdomain "*" 2>output.log &
进入geth控制台的命令:geth attach http://localhost:8545
初始化私链:geth --datadir data/ init genesis.json
启动私链:nohup geth --datadir data/ --networkid 15 --rpc --rpcapi db,eth,net,web3,personal,miner --rpcport 8545 --rpcaddr 0.0.0.0 --allow-insecure-unlock --nodiscover --rpccorsdomain "*" 2>output.log &