You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I was trying to run caliper bind on windows. I was getting the error that it is not able to spawn the npm child process.
Context
I am not sure if this is only a problem with my special setup, but it seems Windows has some problems with spawning a child process. I am no JavaScript expert, but as I understand it child_process.spawn ignores the PATHEXT on Windows and therefore won't find the npm.cmd.
Is anyone facing the same issue on Windows or can reproduce this?
Expected Behavior
npx caliper bind --caliper-bind-sut fabric:2.2
runs without error
Actual Behavior
executing npx caliper bind --caliper-bind-sut fabric:2.2 on Windows gives the following error
$ npx caliper bind --caliper-bind-sut fabric:2.2
2021.11.24-13:43:42.959 info [caliper] [bind] Binding for fabric@2.2. This might take some time...
2021.11.24-13:43:42.960 info [caliper] [bind] Calling npm with: install fabric-network@2.2.3 fabric-ca-client@2.2.3
node:events:368
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn npm',
path: 'npm',
spawnargs: [ 'install', 'fabric-network@2.2.3', 'fabric-ca-client@2.2.3' ]
}
I have tried it using different node and npm versions, so I guess it is not a problem with my node or npm.
Possible Fix
I was able to fix this problem, by changing const {exec, spawn} = require('child_process'); to
While I was trying to run caliper bind on windows. I was getting the error that it is not able to spawn the npm child process.
Context
I am not sure if this is only a problem with my special setup, but it seems Windows has some problems with spawning a child process. I am no JavaScript expert, but as I understand it
child_process.spawn
ignores the PATHEXT on Windows and therefore won't find the npm.cmd.Is anyone facing the same issue on Windows or can reproduce this?
Expected Behavior
npx caliper bind --caliper-bind-sut fabric:2.2
runs without error
Actual Behavior
executing npx caliper bind --caliper-bind-sut fabric:2.2 on Windows gives the following error
I have tried it using different node and npm versions, so I guess it is not a problem with my node or npm.
Possible Fix
I was able to fix this problem, by changing
const {exec, spawn} = require('child_process');
toIn caliper-utils.js
This is replacing nodes own spawn with a cross plattform solution.
Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: