Edge impulse CLI fails to install on Linux

In brief:

  • Installing edge-impulse-cli exactly as documented in the doc fails (error further down below)

  • Attempts at using higher versions of nodejs failed also (different error, see below).
    Note that I can install edge-impulse-linux without any issue.

  • OS: debian based pop-os 22.04, linux kernel 6.2.

  • NodeJS tested version: v14 (installed as in the edgeimpulse doc, using sudo apt install … ); 16.20.1, 18.16.1 and latest 20.4.0

There’s been some reports about the edge impulse CLI failing to install on windows (see: Edge impulse cli installation error), and some on linux (ex. Issue with Linux CLI install - #2 by louis), but the windows solution doesn’t apply (I still did try to remove nodejs, nvm, …) and the linux question suggests a higher version of nodejs which i have tried.

The errors
Error when installing as in the doc, also tried as root as mentioned by @janjongboom in Issue with Linux CLI install - #2 by louis, but root or not, it fails in the same way.

$ sudo node -v
$ sudo npm install -g edge-impulse-cli
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/.node-gyp'
gyp ERR! System Linux 6.2.6-76060206-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings
gyp ERR! node -v v14.21.3
gyp ERR! node-gyp -v v5.1.1
gyp ERR! not ok 
npm WARN tsargs@1.4.1 requires a peer of typescript@^3.1.6 but none is installed. You must install peer dependencies yourself.

npm ERR! errno 1
npm ERR! @serialport/bindings@8.0.8 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @serialport/bindings@8.0.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Using nodejs v18.16.1 (latest lts) or the very latest version, I get this error, which looks very similar to https://forum.edgeimpulse.com/t/edge-impulse-cli-installation-error/3950:

npm ERR! code 1
npm ERR! path ~/.nvm/versions/node/v18.16.1/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings
npm ERR! command failed
npm ERR! command sh -c prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@18.16.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.6 found at "~/.virtualenvs/ocv470/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v18.16.1/node-v18.16.1-headers.tar.gz
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.16.1/node-v18.16.1-headers.tar.gz failed, reason: self-signed certificate in certificate chain
npm ERR! gyp ERR! stack     at ClientRequest.<anonymous> (/home/ludofw/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
npm ERR! gyp ERR! stack     at ClientRequest.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at TLSSocket.socketErrorListener (node:_http_client:502:9)
npm ERR! gyp ERR! stack     at TLSSocket.emit (node:events:525:35)
npm ERR! gyp ERR! stack     at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR! gyp ERR! stack     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! gyp ERR! System Linux 6.2.6-76060206-generic
npm ERR! gyp ERR! command "/home/ludofw/.nvm/versions/node/v18.16.1/bin/node" "/home/ludofw/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/ludofw/.nvm/versions/node/v18.16.1/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings
npm ERR! gyp ERR! node -v v18.16.1
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok

Has anyone faced a similar issue? How did you solve it?



Hi @diplodocuslongus,

A couple of things worth trying:

  • Install exactly node version 16.13.1, as that’s what the Edge Impulse tools are tested on
  • Try running the command with --unsafe-perm to see if that helps

See this as well. It describes a fix for node_modules is not owned by you, but rather by root. This is probably not what you want.