搭建fabric1.0开发环境 make peer和make docker命令时遇到的问题集合 - Go语言中文社区

搭建fabric1.0开发环境 make peer和make docker命令时遇到的问题集合


    中间因为各种原因遇到了很多很多的问题,趁着自己还记住一些赶紧记录下来:

    1:make docker 时遇到了 “fork/exec /usr/bin/gcc: cannot allocate memory" during docker build”报内存不够,那就增大虚拟机的内存即可:(点击设置,内存增大即可)

   

   2:fatal error: ltdl.h: No such file or directory(头文件的缺失)

解决办法:执行sudo apt install libtool libltdl-dev

  

   3:报xxx comand  not  find (命令找不到,在执行Dockerfile文件时)

    解决办法:

        1:先检查是否安装了,没有安装就执行apt  install xxx,然后再尝试

         2:安装了还不行,就打开Dockerfile文件,然后把第一行#!bin/bash改为bin/sh试一下,

         3:还是不行的话(我的是在终端该命令是可以执行的,但是Dockerfile文件里面执行找不到命令),我把该语句拷贝出来放到终端手动执行。然后把Dockerfile里面的这句命令注释起来。这样在执行make命令就不会出错了

    

     4:出现:

      Please replace the Apache license header comment text with:
      SPDX-License-Identifier: Apache-2.0
      Makefile:111: recipe for target 'license' failed
      make: *** [license] Error 1
    解决办法:打开正在执行的镜像的Dockerfile,然后把licence的来源改为:SPDX-License-Identifier: Apache-2.0而不是上面的http://xxxx

    5:关于java插件找不到的错误:

     A problem occurred evaluating root project'spring-integration'.

> Failed to apply plugin [id'java']

> model'tasks' is finalized

解决办法:(查看自己的gradle版本,我的是2.1版本,该插件缺少的问题在2.3版本以后就解决了,所以升级一下版本即可)

6:gradle版本没法安装2.1以上的版本,有依赖冲突问题

解决办法:不要用apt install gradle4.1下载。会有各种依赖报错,下载一个SDKMAN工具,然后用它来下载执行:

sdk install gradle 4.1即可

    7:报xxx comand  not  find (命令找不到,在执行Dockerfile文件时)

    解决办法:

          1:先检查是否安装了,没有安装就执行apt  install xxx,然后再尝试

          2:安装了还不行,就打开Dockerfile文件,然后把第一行#!bin/bash改为bin/sh试一下,

          3:还是不行的话(我的是在终端该命令是可以执行的,但是Dockerfile文件里面执行找不到命令),我把该语句拷贝出来放到终端手动执行。然后把Dockerfile里面的这句命令注释起来。这样在执行make命令就不会出错了

    

      8:cp: cannot stat 'build/docker/gotools/bin/protoc-gen-go': No such file or directory(找不到protoc-gen-go文件)

       解决办法:

            1:You can find the file protoc-gen-go in path: $GOPATH/bin, then copy this file to $GOPATH/src/github.com/hyperledger/fabric/build/docker/gotools/bin/. If all things has done, you can run: make peer and it will work.

            2:如果$GOPATH/bin下面没有protoc-gen-go,检查go环境配置是否正确

            3:protobuf是否没有安装

            进入到/opt/gopath/src/github.com/golang下面,执行:git clone https://git.oschina.net/mellymeng/protobuf.git

            然后目录下面会出现protobuf文件夹,然后再/opt/gopath/src/github.com/golang目录下面执行:

             go get -u github.com/golang/protobuf/protoc-gen-go

             (The compiler plugin, protoc-gen-go, will be installed in $GOBIN, defaulting to $GOPATH/bin. It must be in your $PATH for the protocol compiler, protoc, to find it.

              然后就可以 find the file protoc-gen-go in path: $GOPATH/bin!!!

       9:遇到github.com下载的东西,可以先翻墙下载好然后拷贝进来

      例如其中的gotools, su-exec, gradle-2.12-bin-zip, protobuf, lint, hg等,都可以到git上面下载下来然后放到指定的目录下面,并把执行该步骤的Dockerfile命令注释掉。


    10:执行make docker遇到:core/chaincode/shim/java/javabuild.sh: line 51: gradle: command not found

          

         报JAVA_HOME is not  set and no 'java' 

         原来是我的java没装,赶紧把java装上!执行: apt install openjdk-9-jre-headless

         

        再去执行make docker如果还是报gradle找不到,就进入该文件,把首行改为下图所示:

          

          即可,再次运行就不用管了,就进入到下一个镜像的编译了。

    11:cp略过目录的问题

      

     进入到Makefile文件找到263行,在下面有cp命令时,在后面加上参数-r即可,保存退出重新make

     12:   payload/protoc-gen-go没有该目录

       可以将该句在对应的dockerfile中注释掉,手动执行: cp -r /opt/gopath/bin/protoc-gen-go  /usr/local/bin/

       然后重新进行make docker

  13:npm ERR! request to http://registry.npmjs.org/grunt-cli failed, reason: unable to verify the first certificate

      第一证书问题:将npm中https关闭,执行:npm config set strict-ssl false

      为了加快下载速度,执行:npm config set registry "http://registry.npmjs.org/"

     

     (为了避免版本所引发的各种问题,建议装高版本的!!)

            

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/mellymengyan/article/details/77529747
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-02-24 22:18:46
  • 阅读 ( 1622 )
  • 分类:docker

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢