0

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.

Isha Padalia
  • 877
  • 7
  • 24

2 Answers2

0

A similar problem was reported for users who upgraded to latest version of vscode. One possible cause is Ubuntu 19 gcc compiler does not compile gRPC native source code currently. So its better to use Ubuntu 18.04 or 16.04 untill it is sorted with the grpc-node.

A better workaround for the time being is to install the previous version of VS Code (1.39.2), which can be downloaded here - https://code.visualstudio.com/updates/v1_39

  • Thanks. I'm using macOS Mojave version 10.14.6. So In macOS also I've to downgrade my VS Code extension? – Isha Padalia Mar 13 '20 at 06:44
  • What I could read from a mac user was that it worked fine according to this thread - https://github.com/IBM-Blockchain/blockchain-vscode-extension/issues/1621 However, I would suggest you try that – Noushad Mohamed Mar 13 '20 at 06:46
  • Thanks again. I had already read this post and followed. So wondering why mac users also faced this issue! – Isha Padalia Mar 13 '20 at 06:50
  • See my answer for a complete description about why this occurs – david_k Mar 13 '20 at 08:34
0

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

david_k
  • 5,843
  • 2
  • 9
  • 16
  • Thanks for the brief answer. I had to downgrade my vs code version and already resume my work. But any possibility to resolve this issue in 1.40 or greater version of vs code? – Isha Padalia Mar 13 '20 at 08:42
  • The extension can't solve the problem. It's reliant on what grpc does and the version of grpc used by fabric-sdk-node. If fabric-sdk-node updates it's version of grpc (which may then compile across more compiler versions) then maybe they can update to that but really their hands are tied – david_k Mar 13 '20 at 08:50