Search code examples
visual-studio-codeibm-cloudhyperledger-fabricibm-blockchainibp-vscode-extension

Error in rebuild native npm-module of IBM vs code extesion for fabric


I'm working on the Visual Studio Code extension IBM Blockchain platform for hyperledger fabric. Already I had installed an IBM vs code extension. But when it goes in to rebuild a native node module. It's thrown an error which is

Failed to activate extension: Failed to execute command "npm" with arguments "rebuild, grpc, --target=7.1.11, --runtime=electron, --update-binary, --fallback-to-build, --target_arch=x64, --dist-url=https://atom.io/download/electron" return code 1

VSCode version is 1.43.0.

VS marketplace version is V1.0.23.

node-gyp version is 6.1.0.

Can anyone help me where I have an issue?

Thanks.


Solution

  • The problem is related to VSCode using electron and the fabric that fabric-sdk-node requires node grpc which is a native module. node grpc try to make life easier by providing prebuilt binaries for certain versions of node grpc for certain platforms. That means providing prebuilt binaries for windows, linux and mac as well as special environments such as electron as well as binaries for all the different versions of node grpc. That's a lot of prebuilt binaries to maintain so as vscode kept changing the version of electron and fabric-node-sdk is tested to a specific version of node grpc, no prebuilt binaries were available.

    With no prebuilt binaries node grpc falls back to compiling from source. Compilation is probably only going to be tested against specific versions of compilers for each of the platforms and changes to compilers (eg on linux latest gcc version is 9, yet ubuntu 18.04 still uses gcc 7) can mean that the source won't compile.

    So this is why you are probably experiencing a problem. Downgrading vscode to 1.39 allows node grpc to pull down a pre-built binary avoiding any problems that you may experience having to build the extension from source.

    The problem is that there is very little the IBP Extension can do about this as it is dependent on the version of electron vscode decides to use, whether or not grpc publish pre-built binaries plus the version that fabric-sdk-node has been tested with and specifies in its dependencies.

    As explained in the other answer the most reliable option to solve this is to downgrade vscode to 1.39