Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

The extension requires npm >= 6.x.x, but one of its packages (fabric-shim) requires npm ^5.5.1 #1821

Closed
the-inevitable opened this issue Jan 12, 2020 · 8 comments
Labels

Comments

@the-inevitable
Copy link

Description

I was going through the IBM Blockchain Platform extension tutorial and got stuck on 3-rd step of 1-st section - "3. Package the smart contract".

Having a directory with smart contract project from steps 1 and 2, I tried to package it, but got an error saying Cannot find module - 'fabric-shim'.

When I tried to install the module npm i fabric-shim, it also exited with an error Unsupported engine for fabric-shim@1.4.2: wanted: {"node":"^8.9.0","npm":"^5.5.1"} (current: {"node":"10.18.1","npm":"6.13.4"})

I tried installing fabric-shim@1.4.4, but it also requires npm bersion not higher than 5.5.1.

The main question is:
How is it possible, that the extension requires npm version to be higher than 6.x.x, but one of its dependencies only runs with npm version NOT higher than 5.5.1 ?

Expected Behavior

Every step in tutorial should run smoothly.

Actual Behavior

Having a directory with smart contract project from steps 1 and 2, I tried to package it, but got an error saying Cannot find module - 'fabric-shim'.

When I tried to install the module npm i fabric-shim, it also exited with an error Unsupported engine for fabric-shim@1.4.2: wanted: {"node":"^8.9.0","npm":"^5.5.1"} (current: {"node":"10.18.1","npm":"6.13.4"})

Possible Fix

Adjust dependencies to use correct versions of node and npm

Steps to Reproduce

  1. Start the tutorial
    2.Try to package smart contract
  2. Get an error

Log File

** when trying to package smart contract **
node_modules/fabric-contract-api/types/index.d.ts:10:51 - error TS2307: Cannot find module 'fabric-shim'.

10 import { ChaincodeStub, ClientIdentity } from 'fabric-shim';

** when trying to manually install the dependency **
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/local/bin/nodejs/node-v10.18.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/local/bin/nodejs/node-v10.18.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/local/bin/nodejs/node-v10.18.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/local/bin/nodejs/node-v10.18.1-linux-x64/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/local/bin/nodejs/node-v10.18.1-linux-x64/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/local/bin/nodejs/node-v10.18.1-linux-x64/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 5.0.0-37-generic
gyp ERR! command "/usr/local/bin/nodejs/node-v10.18.1-linux-x64/bin/node" "/usr/local/bin/nodejs/node-v10.18.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/vlad-alephone/projects/ezetech-workspace/ibm_blockchain/ore/node_modules/@ampretia/x509
gyp ERR! node -v v10.18.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN notsup Unsupported engine for fabric-shim@1.4.2: wanted: {"node":"^8.9.0","npm":"^5.5.1"} (current: {"node":"10.18.1","npm":"6.13.4"})
npm WARN notsup Not compatible with your version of node/npm: fabric-shim@1.4.2
npm WARN ore@0.0.1 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ampretia/x509@0.4.7 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ampretia/x509@0.4.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Your Environment

  • IBM Blockchain Platform Extension Version: 1.0.17
  • Visual Studio Code version: 1.39 (downgraded from 1.41 to get rid of another problem with the extension not seeing node path)
  • Environment name and version (e.g. Node.js v8.12.0, npm v6.4.1): Node.hs v10.18.1, npm v6.13.4
  • Operating System and version: Ubuntu 18.04.3 LTS x64
@the-inevitable
Copy link
Author

the-inevitable commented Jan 12, 2020

Workaround here is to manually download unstable version of fabric-shim npm i fabric-shim@2.0.0-snapshot.124, after this command smart contract project was packaged successfully.

Not sure though if this workaround could bring me any troubles later on.

@TheDhejavu
Copy link

@the-inevitable thanks. worked for me.

@erniepty
Copy link

erniepty commented May 9, 2020

@the-inevitable thanks!! It works for me either

@FrancoisStArnaud
Copy link

I also had the problem when completing the IBM Blockchain Platform tutorial. I had the error when I launched the debug in part 7. I tried installing the version of fabric-shim that you recommended, but it started giving me errors on "utf8" in my contract instead. Installing the latest version (2.2.0) will not even fix the fabric-shim not found error.

@ManpreetSingh28
Copy link

Hello,
I was going through the IBM Blockchain Platform extension tutorial and got stuck at A5: 27 section of the tutorial. I was at the stage of 'Run Build Task' for automatic recompilation. But I got 1 error in the Terminal at the end of the process and obviously 'dist' folder underneath the demo-application project did not appear due to that error.

The error is:

Starting compilation in watch mode...
node_modules/fabric-contract-api/types/index.d.ts:10:51 - error TS2307: Cannot find module 'fabric-shim'.
10 import { ChaincodeStub, ClientIdentity } from 'fabric-shim';
[9:36:16 AM] Found 1 error. Watching for file changes.

I also tried installing 'fabric-shim' manually but didn't get sorted things, same error popping up. Please help me with the solution to fix this. Also find the screenshots for your reference.

Looking forward for the solution. Can connect with me at manpreetsinghpuri01@gmail.com.

error 1
error 2
error 3

Thanks!
Manpreet Singh

@ManpreetSingh28
Copy link

Workaround here is to manually download unstable version of fabric-shim npm i fabric-shim@2.0.0-snapshot.124, after this command smart contract project was packaged successfully.

Not sure though if this workaround could bring me any troubles later on.

I tried to do that but still the same issue pops up. Can you help me with some other solution?

@kingaj12
Copy link

FIXED. Had the same problems and the workaround did not help. I suspected that the issues were with the packaging, and yes that was the case.

In the demo-contract directory, in the file package.json you can see the section:

"dependencies": {
    "fabric-contract-api": "^1.4.5",
    "fabric-shim": "^1.4.5"
},

I changed both specifications to 1.4.6 before performing the Instantiate action in the Tutorial section A3.6. The Instantiate action now runs with no problems.

@mchukurs
Copy link

Thanks! This worked for me. Glad I searched before creating a new issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants