rddill-IBM / ZeroToBlockchain

Tutorial for Zero to Blockchain series
342 stars 924 forks source link

Node index chapter06 #48

Closed MohammedOmarBenani closed 5 years ago

MohammedOmarBenani commented 5 years ago

* Following the tutorial, when I run the command node index, I got the following error:

Omar-MBP:chapter06 mac$ node index module.js:550 throw err; ^

Error: Cannot find module 'express' at Function.Module._resolveFilename (module.js:548:15) at Function.Module._load (module.js:475:25) at Module.require (module.js:597:17) at require (internal/module.js:11:18) at Object. (/Users/mac/Documents/ZTB/Chapter06/index.js:19:17) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) Omar-MBP:chapter06 mac$ npm install

* I tried to install the missing modules by running the npm install command /-

Command succeeded

npm notice created a lockfile as package-lock.json. You should commit this file. added 1438 packages from 1163 contributors and audited 25128 packages in 211.59s found 168 vulnerabilities (46 low, 112 moderate, 9 high, 1 critical) run npm audit fix to fix them, or npm audit for details Omar-MBP:chapter06 mac$ npm audit fix npm ERR! code E400 npm ERR! 400 Bad Request - POST https://registry.npmjs.org/-/npm/v1/security/audits

npm ERR! A complete log of this run can be found in: npm ERR! /Users/mac/.npm/_logs/2018-12-11T11_14_15_521Z-debug.log Omar-MBP:chapter06 mac$ ./Users/mac/.npm/_logs/2018-12-11T11_14_15_521Z-debug.log -bash: ./Users/mac/.npm/_logs/2018-12-11T11_14_15_521Z-debug.log: No such file or directory Omar-MBP:chapter06 mac$ npm install-missing

-/ and npm-install-missing: Omar-MBP:chapter06 mac$ npm-install-missing

Package Current Wanted Latest Location chai 3.5.0 3.5.0 4.2.0 zerotoblockchain-network chai-as-promised 6.0.0 6.0.0 7.1.1 zerotoblockchain-network composer-admin 0.16.6 0.16.6 0.20.5 zerotoblockchain-network composer-client 0.16.6 0.16.6 0.20.5 zerotoblockchain-network composer-common 0.16.6 0.16.6 0.20.5 zerotoblockchain-network composer-connector-embedded 0.16.6 0.16.6 0.20.5 zerotoblockchain-network composer-cucumber-steps 0.16.6 0.16.6 0.20.5 zerotoblockchain-network composer-runtime 0.16.6 0.16.6 0.20.5 zerotoblockchain-network composer-runtime-hlfv1 0.16.6 0.16.6 0.20.5 zerotoblockchain-network cucumber 2.3.1 2.3.1 5.0.3 zerotoblockchain-network eslint 3.19.0 3.19.0 5.10.0 zerotoblockchain-network fabric-client 1.2.2 1.2.2 1.3.0 zerotoblockchain-network mocha 3.5.3 3.5.3 5.2.0 zerotoblockchain-network nyc 11.9.0 11.9.0 13.1.0 zerotoblockchain-network vcap_services 0.3.4 0.3.4 0.6.0 zerotoblockchain-network npm-install-missing: No modules seem to be missing. Huzzah!

* after retrying the node index command, I got:

Omar-MBP:chapter06 mac$ node index /Users/mac/Documents/ZTB/Chapter06/node_modules/express/lib/router/route.js:202 throw new Error(msg); ^

Error: Route.get() requires a callback function but got a [object Undefined] at Route.(anonymous function) [as get] (/Users/mac/Documents/ZTB/Chapter06/node_modules/express/lib/router/route.js:202:15) at Function.proto.(anonymous function) [as get] (/Users/mac/Documents/ZTB/Chapter06/node_modules/express/lib/router/index.js:510:19) at Object. (/Users/mac/Documents/ZTB/Chapter06/controller/restapi/router.js:35:8) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Module.require (module.js:597:17) at require (internal/module.js:11:18)

rsarosh commented 5 years ago

I have the same issue as @MohammedOmarBenani , it is closed, but there is no work around mentioned.

Same error I am getting too. I did npm install and then if i try node index i get the following error: rsarosh@rsarosh-VirtualBox:~/blockchain/ZeroToBlockchain/Chapter06$ node index /home/rsarosh/blockchain/ZeroToBlockchain/Chapter06/node_modules/express/lib/router/route.js:202 throw new Error(msg); ^

Error: Route.get() requires a callback function but got a [object Undefined] at Route.(anonymous function) [as get] (/home/rsarosh/blockchain/ZeroToBlockchain/Chapter06/node_modules/express/lib/router/route.js:202:15) at Function.proto.(anonymous function) [as get] (/home/rsarosh/blockchain/ZeroToBlockchain/Chapter06/node_modules/express/lib/router/index.js:510:19) at Object. (/home/rsarosh/blockchain/ZeroToBlockchain/Chapter06/controller/restapi/router.js:35:8) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Module.require (module.js:597:17) at require (internal/module.js:11:18)

rsarosh commented 5 years ago

Got the answer, copy Documentation/answers/composer/hlcClient_complete.js to controller/restapi/features/composer/hlcClient.js. Bob must have mentioned it, but I guess i may have missed it.

rsarosh commented 5 years ago

Got the answer, copy Documentation/answers/composer/hlcClient_complete.js to controller/restapi/features/composer/hlcClient.js. Bob must have mentioned it, but I guess i may have missed it.

Bob talks about it but in the later part of the video, but we all try to run the code in the first half copying his action from the video :)