I first installed the hyperledger using this link: https://hyperledger.github.io/composer/latest/installing/development-tools.html
During the composer install... seems it installed v0.19.x.
So when i ran the command ./createPeerAdminCard.sh ... i got an error:
"v0.19.x is not supported for this level of fabric. Please use version 0.16"...
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
>>
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
Using this link i am able to create the .cto file without any issues.
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);
}
Error found! SyntaxError: Failed to parse null: Unexpected token (6:6)
When i googled for this issue.. i see this same issue reported in below link: Unexpected token (6:6) ...
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...
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.* 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:
npm uninstall -g
the modulesrm -rf ~/.composer
to remove the v0.16 versions of of cardsfabric-dev-servers
folder and contents (this might be calledfabric-tools
if it is an old version)docker ps
You should then be OK to go back to the "Install" doc, and the Developers Tutorial.