Cannot find module fabric-network - is my application installation done wrong

0 votes

Hey community,

When I reach the step with installing the the application with npm install and then run ls I don't see the file package-lock.json. When I do the NPM install I have also tryed writing sudo npm install since I before have seen errors with missing rights to access.

In the next step where i run node enrollAdmin I get the error Error: Cannot find module 'fabric-network'. Is there missing anything in my installation?

I'm running Mac OS Mojave v10.14.5 - node v8.9.4 - npm v5.6.0.

Best regards Jeppe

May 20, 2019 in Blockchain by Jeppe
• 210 points
5,168 views

4 answers to this question.

0 votes
Best answer

First, install grpc and run it:

$ npm install grpc
$ grpc
answered May 20, 2019 by John

selected May 20, 2019 by Jeppe

I try to run from the fabcar directory these two commands. After npm install grpc I get:

grpc@1.20.3 install /Users/x/x/fabric-samples/fabcar/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using needle for node-pre-gyp https download
[grpc] Success: "/Users/x/x/fabric-samples/fabcar/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node" is installed via remote

npm WARN fabcar@1.0.0 No description
npm WARN fabcar@1.0.0 No repository field.

+ grpc@1.20.3
updated 1 package in 5.588s

This seems to be alright, since it is only warnings and it says success to the installation.

But when I'm running grpc I get:

-bash: grpc: command not found

Should I change directory to the one above, where grpc is installed?

I did a little research and found that installing grpc should be enough. Can you run

node enrollAdmin 

and see if it works now?

0 votes

I had the same problem. The following solution worked for me:

$ npm update
$ npm install 
answered May 20, 2019 by Rishi
Thank you for your answer. But if I update npm - wouldn't I get version 9.x.x? In there requirement it says only version 8.9 is supported?

Does it matter in which folder I'm running the commands from?

Is it necessary to use sudo in front of the commands?

Best regards Jeppe
Hi @Jeppe.

In that case, you shouldn't update it. It does matter which folder you run the commands from. You should run thr command in the folder that contains the hyperledger project.
+1 vote

I managed to get it to enroll admin. I did two things and I'm not completely sure which of the commands were where the magic happend.

I did the following:

1)

$ npm install grpc

$ grpc

2)

$ npm install --python=python2.7

The second command was due to the fact that the prerequisites was python 2.7 - even though it was written for Ubuntu user only I hope my post can help others in the future, like you two helped me!

answered May 20, 2019 by Jeppe
• 210 points

edited May 20, 2019 by Omkar
Glad to be of help! @Jeppe

Just wanted to clarify something. Did you try running it after installing grpc and before making changes to python? I want to analyze whether the solution was grpc or python.

Thanks!

@Rishi: As I wrote to John, it said -bash: grpc: command not found  when I tried to run grpc. So I assumed it didn't worked, but to be honest I didn't tried to run enroll admin immediately after before I ran npm install --python=python2.7.

Ok thanks! @Jeppe
+1 vote

This worked for me  const Wallets = require('fabric-network'); instead of const {Wallets} = require('fabric-network');

answered Apr 14, 2020 by Aditi

Related Questions In Blockchain

0 votes
1 answer

My first Hyperledger fabric network is not working

Delete as admin the channel-artifacts folder, down ...READ MORE

answered Aug 10, 2018 in Blockchain by Johnathon
• 9,090 points
2,022 views
0 votes
4 answers

Hyperledger fabric: enrollAdmin.js Error: Cannot find module 'fabric-client'

Change your directory to fabric-samples/fabrcar. And run: npm ...READ MORE

answered Nov 21, 2018 in Blockchain by Omkar
• 69,220 points
5,298 views
0 votes
1 answer

How do I use hyperledger fabric blockchain to build my own application?

To use fabric I would recommend you ...READ MORE

answered May 17, 2018 in Blockchain by Johnathon
• 9,090 points
1,093 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,479 views
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,740 points
1,046 views
+1 vote
1 answer
0 votes
1 answer

What is my chaincode ID in Hyperledger Fabric?

Hey. You have used chaincode id but ...READ MORE

answered Nov 21, 2018 in Blockchain by Omkar
• 69,220 points
1,901 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP