I am pretty new to Hyperledger fabric and StackOverflow as well. I was trying to experiment with the fabcar example - https://hyperledger-fabric.readthedocs.io/en/release-1.4/write_first_app.html on Hyperledger. However, I am unable to proceed with enrolling the Admin.
After issuing
npm install
node enrollAdmin.js
in the fabcar/javascript directory, I am hitting the error
internal/modules/cjs/loader.js:985
throw err;
^
Error: Cannot find module './utils.js'
Require stack:
- /b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/lib/FabricCAServices.js
- /b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/index.js
- /b/workspace/fabric-samples/fabcar/javascript/enrollAdmin.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/lib/FabricCAServices.js:10:15)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/lib/FabricCAServices.js',
'/b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/index.js',
'/b/workspace/fabric-samples/fabcar/javascript/enrollAdmin.js'
]
}
I'm not sure if this is some single sourcing problem between the fabric client and the fabric-ca-client. I have tried uninstalling and reinstalling nodejs and npm. I have also tried pruning all the docker images, networks, volumes and start from scratch.
Here's the package.json for reference:
{
"name": "fabcar",
"version": "1.0.0",
"description": "FabCar application implemented in JavaScript",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "nyc mocha --recursive"
},
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"dependencies": {
"fabric-ca-client": "~1.4.0",
"fabric-network": "~1.4.0"
},
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^5.9.0",
"mocha": "^5.2.0",
"nyc": "^13.1.0",
"sinon": "^7.1.1",
"sinon-chai": "^3.3.0"
},
"nyc": {
"exclude": [
"coverage/**",
"test/**"
],
"reporter": [
"text-summary",
"html"
],
"all": true,
"check-coverage": true,
"statements": 100,
"branches": 100,
"functions": 100,
"lines": 100
}
}
Can someone please help me find out what I might be missing here?
Environment details:
Ubuntu on Windows Subsystem for Linux
Node js version: v12.16.1
npm version: 6.13.4
Docker compose version: docker-compose version 1.22.0, build f46880fe
Docker version: Docker version 19.03.6, build 369ce74a3c
Fabric binaries: 1.4.0
There are some issues with the new "fabric-ca-client" package.Some minor updates changed the dependencies. So, The working version is: "fabric-ca-client": "1.4.0"
I removed the tilde(~) to download the exact version.Rest of the dependencies and their versions are same.
I had also faced this issue. And now I'm following this process to resolve.
step:1 Check a fabric local version.I'm using 1.4.6.
command:
curl https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s -- 1.4.6 1.4.6 0.4.18
step:2
cd fabric-samples/first-networks
step:3 To check this version is working or not.
./byfn.sh generate
step:4
./byfn.sh up
step:5 Now down the network.
./byfn.sh down
After checking all the above process you can start fabcar
project.
I successfully import my admin and user1 identity.
Hope it will help you:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.