gRPC - Build Errors

Hi,

I am trying to build the JSON RPC, but I don’t know how to get past the build errors.

I have never built a jsNode project before, any guidance would be appreciated.

Code Base:
GitHub - Concordium/concordium-json-rpc

Output of build:

C:\Code\Chain-SDKs\Concordium>npm i grpc-tools

changed 1 package, and audited 620 packages in 3s

63 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

C:\Code\Chain-SDKs\Concordium>npm audit fix

up to date, audited 620 packages in 3s

63 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

C:\Code\Chain-SDKs\Concordium>git submodule update --init

C:\Code\Chain-SDKs\Concordium>yarn build
yarn run v1.22.19
warning …\package.json: No license field
$ tsc
src/client.ts:1:27 - error TS2307: Cannot find module ‘…/grpc/concordium_p2p_rpc_grpc_pb’ or its corresponding type declarations.

1 import { P2PClient } from ‘…/grpc/concordium_p2p_rpc_grpc_pb’;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/client.ts:54:49 - error TS7006: Parameter ‘error’ implicitly has an ‘any’ type.

54 this.client.waitForReady(deadline, (error) => {
~~~~~

src/methods.ts:14:8 - error TS2307: Cannot find module ‘…/grpc/concordium_p2p_rpc_pb’ or its corresponding type declarations.

14 } from ‘…/grpc/concordium_p2p_rpc_pb’;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 3 errors.

error Command failed with exit code 2.
info Visit yarn run | Yarn for documentation about this command.

Hello and thank you for contacting Concordium Tech Support

We will get back to you ASAP.

Regards,
Concordium Tech Support

Hello

Have you tried to look at this one, and follow the build instructions?

Hi Zoltan,
Yes I did try that, I get stuck on this line

yarn build

Hi there.

To me, it looks like you missed the line inbetween the two commands you describe in the original post. The sequence is:

git submodule update --init - fetches git dependencies
yarn generate - generates types used for grpc
yarn build - builds the project

The commands must be executed in the listed order, otherwise it will fail. The first 2 commands are only required to run once. On subsequent builds you would only need to run yarn build.

Hope this helps.

Best regards,
Søren.

Hi Soerenbz,

Apollogies for that, I was paying around with my batch file, and must have moved them. The generate command is throwing the below error;

C:\Code\Chain-SDKs\Concordium>npm i grpc-tools

changed 1 package, and audited 620 packages in 4s

63 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

C:\Code\Chain-SDKs\Concordium>npm audit fix

up to date, audited 620 packages in 1s

63 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

C:\Code\Chain-SDKs\Concordium>git submodule update --init

C:\Code\Chain-SDKs\Concordium>yarn generate
yarn run v1.22.19
warning ..\package.json: No license field
$ mkdir -p grpc && yarn generate-js && yarn generate-ts
warning ..\package.json: No license field
$ yarn run grpc_tools_node_protoc --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto
warning ..\package.json: No license field
$ C:\Code\Chain-SDKs\Concordium\node_modules\.bin\grpc_tools_node_protoc --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto
C:\Code\Chain-SDKs\Concordium\node_modules\grpc-tools\bin\protoc.js:41
    throw error;
    ^

Error: Command failed: C:\Code\Chain-SDKs\Concordium\node_modules\grpc-tools\bin\protoc.exe --plugin=protoc-gen-grpc=C:\Code\Chain-SDKs\Concordium\node_modules\grpc-tools\bin\grpc_node_plugin.exe --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto

    at ChildProcess.exithandler (node:child_process:412:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 3221225781,
  killed: false,
  signal: null,
  cmd: 'C:\\Code\\Chain-SDKs\\Concordium\\node_modules\\grpc-tools\\bin\\protoc.exe --plugin=protoc-gen-grpc=C:\\Code\\Chain-SDKs\\Concordium\\node_modules\\grpc-tools\\bin\\grpc_node_plugin.exe --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto'
}

Node.js v18.12.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Hi again.

I noticed you install grpc-tools manually. Could you instead try running

  • yarn install (installs project dependencies, including grpc-tools)
  • yarn generate
  • yarn build

I realise the first step in the sequence above is missing from the readme. I’ll make sure it’s added. Sorry for the inconvenience.

Best regards,
Søren.

Hi Soerenbz,

We Just refreshed my code base as I was getting issues regarding sub folders already existing.

Anyway, re-ran the sequence you gave me, and yarn generate is throwing the below error.

C:\Code\Chain-SDKs\Concordium>yarn generate
yarn run v1.22.19
warning ..\package.json: No license field
$ mkdir -p grpc && yarn generate-js && yarn generate-ts
warning ..\package.json: No license field
$ yarn run grpc_tools_node_protoc --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto
warning ..\package.json: No license field
$ C:\Code\Chain-SDKs\Concordium\node_modules\.bin\grpc_tools_node_protoc --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto
Invalid file name pattern or missing input file "deps/concordium-grpc-api/*.proto"
C:\Code\Chain-SDKs\Concordium\node_modules\grpc-tools\bin\protoc.js:41
    throw error;
    ^

Error: Command failed: C:\Code\Chain-SDKs\Concordium\node_modules\grpc-tools\bin\protoc.exe --plugin=protoc-gen-grpc=C:\Code\Chain-SDKs\Concordium\node_modules\grpc-tools\bin\grpc_node_plugin.exe --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto
Invalid file name pattern or missing input file "deps/concordium-grpc-api/*.proto"

    at ChildProcess.exithandler (node:child_process:412:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:313:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'C:\\Code\\Chain-SDKs\\Concordium\\node_modules\\grpc-tools\\bin\\protoc.exe --plugin=protoc-gen-grpc=C:\\Code\\Chain-SDKs\\Concordium\\node_modules\\grpc-tools\\bin\\grpc_node_plugin.exe --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto'
}

Node.js v18.12.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Hi.

It seems you’re having issues with dependencies, both

  • the grpc-tools library, which should be installed by the yarn install command, and
  • the files used for generating the grpc interface (.proto files), which should be installed by the git submodules update --init command.

Can you try the following:

  1. Delete the directory: C:\Chain-SDKs\Concordium
  2. Clone the concordium-json-rpc repository again
  3. cd into the directory created from clone
  4. Run commands git submodule update --init, yarn install, yarn generate, and yarn build sequentially.

Looking forward to hearing if this helps, otherwise please don’t hesitate to write again.

Hi Soerenbz,

I deleted the folder on my pc, created a new one called “concordium-json-rpc”, and cloned the code base from this URL;

The “yarn generate” command is still throwing the error below. Thanks for looking into this.

C:\Code\Chain-SDKs>cd concordium-json-rpc

C:\Code\Chain-SDKs\concordium-json-rpc>git submodule update --init

C:\Code\Chain-SDKs\concordium-json-rpc>yarn install
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 6.19s.

C:\Code\Chain-SDKs\concordium-json-rpc>yarn generate
yarn run v1.22.19
$ mkdir -p grpc && yarn generate-js && yarn generate-ts
$ yarn run grpc_tools_node_protoc --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto
$ C:\Code\Chain-SDKs\concordium-json-rpc\node_modules\.bin\grpc_tools_node_protoc --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto
--grpc_out: protoc-gen-grpc: %1 is not a valid Win32 application.

C:\Code\Chain-SDKs\concordium-json-rpc\node_modules\grpc-tools\bin\protoc.js:41
    throw error;
    ^

Error: Command failed: C:\Code\Chain-SDKs\concordium-json-rpc\node_modules\grpc-tools\bin\protoc.exe --plugin=protoc-gen-grpc=C:\Code\Chain-SDKs\concordium-json-rpc\node_modules\grpc-tools\bin\grpc_node_plugin.exe --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto
--grpc_out: protoc-gen-grpc: %1 is not a valid Win32 application.


    at ChildProcess.exithandler (node:child_process:412:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:313:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'C:\\Code\\Chain-SDKs\\concordium-json-rpc\\node_modules\\grpc-tools\\bin\\protoc.exe --plugin=protoc-gen-grpc=C:\\Code\\Chain-SDKs\\concordium-json-rpc\\node_modules\\grpc-tools\\bin\\grpc_node_plugin.exe --js_out=import_style=commonjs,binary:grpc --grpc_out=grpc_js:grpc --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin -I ./deps/concordium-grpc-api deps/concordium-grpc-api/*.proto'
}

Node.js v18.12.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

C:\Code\Chain-SDKs\concordium-json-rpc>

That’s a weird error: 1% is not a valid Win32 application. I have no experience personally with building and running the project on windows. Can try to build it on a windows machine when I get the time.

Best regards,
Søren.

1 Like

Hi Soerenbz,
Have you had a chance to look at this on a windows machine?