Hyperledger Playground教程面临的问题

问题描述:

我首先使用以下链接安装了超级账本: https://hyperledger.github.io/composer/latest/installing/development-tools.html

I first installed the hyperledger using this link: https://hyperledger.github.io/composer/latest/installing/development-tools.html

在安装作曲家期间...似乎它已安装v0.19.x.

During the composer install... seems it installed v0.19.x.

所以当我运行命令./createPeerAdminCard.sh ...时出现错误:

So when i ran the command ./createPeerAdminCard.sh ... i got an error:

此级别的结构不支持v0.19.x.请使用版本0.16" ...

"v0.19.x is not supported for this level of fabric. Please use version 0.16"...

我检查了脚本fabric-scripts/hlfv1/createPeerAdminCard.sh,它确实说该版本应为0.16.x.

I checked the script fabric-scripts/hlfv1/createPeerAdminCard.sh and it indeed says that the version should be 0.16.x.. Sample snippet from the script which does the version check:

>>
AWKRET=$(echo $COMPOSER_VERSION | awk -F. '{if ($2<15 || $2>16) print "1"; else print "0";}')
    if [ $AWKRET -eq 1 ]; then
        echo $COMPOSER_VERSION is not supported for this level of fabric. **Please use version 0.16**
        exit 1
>>

然后我去卸载了v0.19.x并安装了composer-cli@0.16.6 ...对上面安装链接中提到的所有模块进行了此操作.

So then i went and uninstalled v0.19.x and installed composer-cli@0.16.6... did this for all the modules mentioned in the install link above.

在此之后,我能够成功获取我的结构环境设置.

After this i was able to successfully get my fabric environment setup.

现在我正在使用此链接中的游乐场教程来创建业务网络.

Now am using the playground tutorial in this link to create business network.

https://hyperledger.github.io/composer/latest /tutorials/playground-tutorial.html

使用此链接,我可以创建.cto文件,而不会出现任何问题.

Using this link i am able to create the .cto file without any issues.

但是当我使用以下内容创建脚本文件即scrip.js时,会出现错误.

But when i create the script file i.e scrip.js with below content i get an error.

/**
 * Track the trade of a commodity from one trader to another
 * @param {org.example.mynetwork.Trade} trade - the trade to be processed
 * @transaction
 */
function tradeCommodity(trade) {
    trade.commodity.owner = trade.newOwner;
    let assetRegistry = await getAssetRegistry('org.example.mynetwork.Commodity');
    await assetRegistry.update(trade.commodity);
}

发现错误! SyntaxError:无法解析null:意外令牌(6:6)

Error found! SyntaxError: Failed to parse null: Unexpected token (6:6)

当我用Google搜索该问题时..我在以下链接中看到了同一问题的报告: 意外的令牌(6:6) ...

When i googled for this issue.. i see this same issue reported in below link: Unexpected token (6:6) ...

所以现在上面链接中提到的此问题的解决方法是:v0.16.x不支持async和ES6关键字...并升级到0.17.x及更高版本...

So now the fix to this issue mentioned in above link is that.. the v0.16.x does not support async and ES6 keywords... and upgrade to 0.17.x and higher...

所以现在卡住了..因为如果我将作曲家升级到v0.17x,则上述createPeerAdminCard.sh将会失败...而如果我坚持使用0.16.x,那么我会遇到上述脚本解析问题.

So now am stuck.. since if i upgrade the composer to v0.17x the above createPeerAdminCard.sh will fail... and if i stick with 0.16.x then i get the above script parsing issue.

能否请您帮忙或指导我解决此问题的方法?

Can you please help or guide me out on what should be the fix for this issue?

v0.19.*是Composer的受支持版本,因此正如Leonardo所说的,您应该删除v0.16和Fabric 1.0,并在更高版本中重新启动" .这些是主要步骤:

v0.19.* is the supported version of Composer, so as Leonardo says you should remove v0.16 and Fabric 1.0 and 'restart' with the later versions. These are the broad steps:

  1. 停止并删除docker容器
  2. 删除Docker映像
  3. npm uninstall -g模块
  4. rm -rf ~/.composer删除卡的v0.16版本
  5. 删除fabric-dev-servers文件夹和内容(如果它是旧版本,则可能称为fabric-tools)
  6. 下载新版本的fabric-dev-servers,并运行downloadFabric.sh脚本
  7. 使用docker ps
  8. 检查Fabric容器的版本
  1. Stop and remove the docker containers
  2. Remove the Docker images
  3. npm uninstall -g the modules
  4. rm -rf ~/.composer to remove the v0.16 versions of of cards
  5. remove fabric-dev-servers folder and contents (this might be called fabric-tools if it is an old version)
  6. download new version of fabric-dev-servers, and run the downloadFabric.sh script
  7. Check the versions of the Fabric containers with docker ps

然后您应该可以返回到安装"文档和开发人员指南".

You should then be OK to go back to the "Install" doc, and the Developers Tutorial.