0

I am running the fabcar fabric-sample, in fabcar folder i run ./startFabric.sh that worked fine and network launched from start to end. but after that when i running node enrollAdmin.js in javascript folder it shows the following error!!! My OS is ubuntu 18.4

I tried different solutions given on internet like npm install etc but non of them worked.

node enrollAdmin.js error logs

module.js:549
    throw err;
    ^

Error: Cannot find module 'fabric-network'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/hyperledger/fabric-samples/fabcar/javascript/enrollAdmin.js:8:47)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

Noor Khan
  • 151
  • 1
  • 9
  • `Error: Cannot find module 'fabric-network' what is fabric-network ? you have to be be clear please paste all necessary code to github and paste here a link i will have a look – Narendranath Reddy Oct 30 '19 at 06:21
  • This is the standard fabcar example given by hyperledger fabric platform in fabric-samples (https://github.com/hyperledger/fabric-samples) the error is in enrollAdmin.js line no 8:47 `const { FileSystemWallet, X509WalletMixin } = require('fabric-network');` @NarendranathReddy – Noor Khan Oct 30 '19 at 06:30
  • OK, so you are not changing anything present inside fabcar, the error says fabric-network module not found, what is your system os arch ? – Narendranath Reddy Oct 30 '19 at 06:46
  • Wow, i solved the problem giving command `sudo npm install --unsafe-perm` in fabcar directory. got this solution from https://jm4488.tistory.com/category/Programming/BlockChain – Noor Khan Oct 30 '19 at 07:09
  • actually problem accured cos of not installing node modules, you should first run the "npm install" inside the javascript directory, then everything should be fine! – Farkhod Abdukodirov Oct 30 '19 at 07:17
  • @Franky that is the problem i tried many times `npm install` in javascript directory but didn't succeed. I think we need to run this command in fabcar directory actually. As i run `/usr/local/hyperledger/fabric-samples/fabcar$ sudo npm install --unsafe-perm ` and succeeded. maybe `npm install` would also work in fabcar... – Noor Khan Oct 30 '19 at 07:43
  • @NoorKhan maybe u r right, cos u r working on Ubuntu, but in windows case, node modules should be installed in fabric-samples/fabcar/javascript directory, otherwise it doesn't read the .js files~ – Farkhod Abdukodirov Oct 31 '19 at 11:35
  • Copy package.json from javascript folder to fabcar and then run `sudo npm install --unsafe-perm` in fabcar directory – Noor Khan Nov 12 '19 at 06:14

0 Answers0