區塊鏈 App 產生器 CLI 疑難排解

您可以使用下列資訊來疑難排解 Blockchain App Builder CLI 的系統問題。

先決條件問題
如果您修改或升級 Blockchain App Builder 所需的任何先決條件軟體,可能會發生錯誤。您可以使用 preReqCheck 命令來檢查您的區塊鏈 App 產生器安裝是否仍符合先決條件。

用法:

preReqCheck [options]
my-mac:TsProject myname$ ochain preReqCheck -h 
Usage: patch [options]

Validates the pre-requisites of Blockchain App Builder 

Options :
    -h, --help              output command usage information
    -D, --debug             enable debug logging
如果您嘗試安裝區塊鏈 App 產生器時先決條件檢查失敗,但出現錯誤和警告,您可能會見到類似以下範例的錯誤:
npm ERR! code 1
npm ERR! path C:\Users\opc\AppData\Roaming\npm\node_modules\@oracle\ochain-cli
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node build/pre-install.js
npm ERR! NodeJs version is correct.
npm ERR! NPM version is correct.
npm ERR! Error:
npm ERR! Found 1 error(s) in pre-requisites check, failed with following errors:
npm ERR! 1. Golang version mismatch. Expected 1.20.x, but found 1.18.5.
npm ERR!
npm ERR! Found 3 warning(s) in pre-requisites check.
npm ERR! 1. Docker is not installed. Please install Docker >= 18.09.0. To deploy chaincodes in the local environment, please install the recommended version of Docker.
npm ERR! 2. Docker Compose is not installed. Please install Docker Compose >= 1.23.0. To deploy chaincodes in the local environment, please install the recommended version of Docker Compose.
npm ERR! 3. Git is not Installed. To sync chaincodes, please install the Git according to the documentation.
npm ERR!     at preRequsiteCheck (C:\Users\opc\AppData\Roaming\npm\node_modules\@oracle\ochain-cli\build\lib\util\pre-install.js:435:15)
npm ERR!     at Object.<anonymous> (C:\Users\opc\AppData\Roaming\npm\node_modules\@oracle\ochain-cli\build\pre-install.js:10:44)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1254:14)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1117:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:958:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:23:47
 
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\opc\AppData\Local\npm-cache\_logs\2023-08-25T09_58_34_514Z-debug-0.log
部署失敗
由於部署失敗、部署損毀、Docker 對等容器已滿,或是在本機網路中終止的 Docker 對等,您可能會看到類似以下的錯誤:
============ Started instantiate Chaincode ============
[2028-19-01T19:25:lO.372] [ERROR] default - Error instantiating Chaincode GollGl on channel mychannel, detailed 
error: Error: error starting container: error starting container: Failed to generate platform-specific docker 
build: Failed to pull hyperledger/fabric-ccenv:latest : API error (404): manifest for hyperledger/ 
fabric-ccenv:latest not found: manifest unknown: manifest unknown [2020-19-01T19:25:10.372] (INFO) default -
============ Finished instantiate Chaincode ============
[2020-19-01119:25:10.372] [ERROR] default - Error: Error instantiating Chaincode Goll01 on channel mychannel, 
detailed error: Error: error starting container: error starting container: Failed to generate platfom-specific 
docker build: Failed to pull hyperledger/fabric-ccenv: latest : API error (404): manifest for hyperledger/ 
fabric-ccenv:lalest not found: manifest unknown: manifest unknown exited: signal: terminated 
INFO: exited: signal: terminated

ERROR: Error in Chaincode deployment
這是因為對等容器無法正確重新啟動。若要解決此行為,請完成下列步驟。
  • 在 chaincode 專案中開啟新的終端機視窗,然後執行 ochain run -b 命令。
Blockchain App Builder CLI 會重建本機結構環境,並將您的鏈碼部署到新的環境。
Mac OSX:Xcode
在 Mac OSX 升級或未安裝 Xcode 之後,您可能會在錯誤日誌中看到類似以下的錯誤:
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at
  • 如果要解決此行為,請開啟終端機視窗,然後執行下列指令:
    sudo rm -rf $(xcode-select --print-path)
    xcode-select --install