create-channel.js had required a path change
Closed this issue · 11 comments
I had to change it to
var
_commonProto = grpc.load(path.join(__dirname, '**../application/**node_modules/fabric-client/lib/protos/common/common.proto')).common;
var _configtxProto = grpc.load(path.join(__dirname,
'../application/node_modules/fabric-client/lib/protos/common/configtx.proto')).common;
to make it work. Please consider it if it is valid for all. Thanks
Why did you need this change? What was not working without it?
hypledvm@hypledvm-VirtualBox:~/go/src/utilitypoc/application$ node app.js
info: [ClientUtils]:
- Using temp dir: ../network/client-certs
/home/node_modules/grpc/index.js:146
return loadObject(builder.ns, options);
^
TypeError: Cannot read property 'ns' of null
at Object.load (/home/node_modules/grpc/index.js:146:29)
at Object. (/home/hypledvm/go/src/utilitypoc/middleware/create-channel.js:26:25)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object. (/home/hypledvm/go/src/utilitypoc/application/app.js:32:21)
Changing the directory here works
Did you follow the instructions in middleware
and install the NPM modules before trying to run the application
? That's a prerequisite mentioned both in the instructions in this repo and in the chapter (where we walk through middleware
before application
.) This sequencing has a particular logic.
FYI, you need to run npm install
in middleware/
. But do sync the latest code though; I fixed dependency versions a few days ago (because the remote repository for the NPM packages got upgraded.)
- Please confirm that what I suggested worked, and then close the issue.
- If you didn't follow the instructions in sequence as specified, clearly you are bound to hit a problem or two somewhere. It's always possible to hack your way out of it, as you did, but that can't be something we can prescribe for others.
In this instance, you were missing dependencies, which you could identify from the exception stack. That ought to have been a clue that you missed (or skipped) a step or two in the instructions.
Let me reiterate that the book (or this code repo) is not meant to be a primer in Go or JavaScript programming (though you get some more lessons in the Composer chapters for the languages used there.) If you are not handy with these languages, you need to be extra careful in following instructions while learning something in the process.
Lastly, though I'd like to be helpful, especially to our book customers, I'm afraid I can't be addressing issues at this rate. I (like all the authors of this book) have a day job that keeps me busy. Maintaining this code base is strictly a side project for me.
So I'd encourage you to learn from the book and especially understand the rationale behind the steps performed. That'll help you sort out issues.
Of course, if you do find a real problem with the code or the instructions, file a bug report and we'll try to address it ASAP. But make sure you've exhausted your options first.
Thanks, and good luck!
Not a problem. Even if you encounter issues with adaptations to other apps and other network structures because of inadequacies in our instructions, it's useful to bring them to our attention. But do note that we'll get to work on them on a best-effort basis.