建立chaincode包出错
[lj@localhost test-network]$ peer lifecycle chaincode package fabcar.tar.gz --path ../chaincode/fabcar/go/ --lang golang --label fabcar_1
2022-06-03 22:27:18.115 CST [main] InitCmd -> ERRO 001 Fatal error when initializing core config : error when reading core config file: Config File "core" Not Found in "[/home/lj/fabric/scripts/fabric-samples/test-network]"
解决方法:
peer的可执行二级制文件在fabric-sample的bin文件夹中。使用如下命令添加Peer到CLI命令路径中
cd ../../../test-network
export PATH=${
PWD}/../bin:$PATH
还需要设置指向fabric-samples中core.yaml的FABRIC_CFG_PATH
export FABRIC_CFG_PATH=$PWD/../config/
然后再次执行该语句
运行结果:这次没有报错
[lj@localhost test-network]$ export PATH=${
PWD}/../bin:$PATH
[lj@localhost test-network]$ export FABRIC_CFG_PATH=$PWD/../config/
[lj@localhost test-network]$ peer lifecycle chaincode package fabcar.tar.gz --path ../chaincode/fabcar/go/ --lang golang --label fabcar_1
[lj@localhost test-network]$