Running the typescript balance-transfer app

There are several problems you will run into. First problem is this

you won’t be able to run ts-node after npm installing it. To fix it modify the PATH environment variable

PATH=$PATH:./node_modules/.bin

Next problem is when you try to run ./runApp.sh it will give

============== node modules installed already =============

cp: cannot create regular file ‘node_modules/fabric-client/index.d.ts’: No such file or directory
cp: cannot create regular file ‘node_modules/fabric-ca-client/index.d.ts’: No such file or directory
/home/siddjain/fabric-samples-v13/balance-transfer/typescript/node_modules/ts-node/src/index.ts:307
        throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
              ^
TSError: ⨯ Unable to compile TypeScript
Solution to this is to run

npm install before running ./runApp.sh. once you do that, you should now see
============== node modules installed already =============

[2018-11-29 18:56:17.141] [DEBUG] Helper – [crypto_ecdsa_aes]: Hash algorithm: SHA2, hash output size: 256
[2018-11-29 18:56:17.224] [DEBUG] Helper – [utils.CryptoKeyStore]: CryptoKeyStore, constructor – start
[2018-11-29 18:56:17.225] [DEBUG] Helper – [utils.CryptoKeyStore]: constructor, no super class specified, using config: fabric-client/lib/impl/FileKeyValueStore.js
[2018-11-29 18:56:17.234] [DEBUG] Helper – [crypto_ecdsa_aes]: Hash algorithm: SHA2, hash output size: 256
[2018-11-29 18:56:17.235] [DEBUG] Helper – [utils.CryptoKeyStore]: CryptoKeyStore, constructor – start
[2018-11-29 18:56:17.235] [DEBUG] Helper – [utils.CryptoKeyStore]: constructor, no super class specified, using config: fabric-client/lib/impl/FileKeyValueStore.js
[2018-11-29 18:56:17.248] [INFO] SampleWebApp – ****************** SERVER STARTED ************************
[2018-11-29 18:56:17.248] [INFO] SampleWebApp – **************  http://localhost:4000  ******************

(node:714) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead

Next note that on their README.md they say

  • Node.js v6.9.0 – 6.10.0 ( Node v7+ is not supported )

Screen Shot 2018-11-30 at 10.17.49 AM

However that is plain wrong. In fact you will need to have Node v8 installed (nothing more and nothing less) since the async-await was introduced only in v8 of Node.

the HL Fabric prerequisites say that
If you will be developing applications for Hyperledger Fabric leveraging the Hyperledger Fabric SDK for Node.js, you will need to have version 8.9.x of Node.js installed.
Advertisements
This entry was posted in Software. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s