Issues with edge-impulse-cli on MacOS10.15

Hi - I am not able to connect to my brand new Arduino nano 33 sense.
trouble seems to start with typescript 3.1.6. has someone an idea?
I may have made stupid mistakes :wink:
See also log - thanks!

Family-Air:usr root# npm install typescript@3.1.6
npm WARN checkPermissions Missing write access to /usr
npm WARN enoent ENOENT: no such file or directory, open ‘/usr/package.json’
npm WARN usr No description
npm WARN usr No repository field.
npm WARN usr No README data
npm WARN usr No license field.

npm ERR! code EPERM
npm ERR! syscall access
npm ERR! path /usr
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, access ‘/usr’
npm ERR! [Error: EPERM: operation not permitted, access ‘/usr’] {
npm ERR! errno: -1,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/usr’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /var/root/.npm/_logs/2020-07-03T11_43_48_343Z-debug.log
Family-Air:usr root# npm install -g typescript
/usr/local/bin/tsserver -> /usr/local/lib/node_modules/typescript/bin/tsserver
/usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc

  • typescript@3.9.6
    updated 1 package in 1.49s
    Family-Air:usr root# npm install --force -g edge-impulse-cli @serialport/terminal
    npm WARN using --force I sure hope you know what you are doing.
    npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
    /usr/local/bin/serialport-terminal -> /usr/local/lib/node_modules/@serialport/terminal/lib/index.js
    /usr/local/bin/edge-impulse-daemon -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/daemon.js
    /usr/local/bin/edge-impulse-uploader -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/uploader.js
    /usr/local/bin/edge-impulse-data-forwarder -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/data-forwarder.js
    /usr/local/bin/eta-flash-tool -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/eta-flash-tool/flashtool.js
    npm WARN tsargs@1.4.0 requires a peer of typescript@^3.1.6 but none is installed. You must install peer dependencies yourself.

  • edge-impulse-cli@1.7.0

  • @serialport/terminal@9.0.0
    updated 2 packages in 11.536s
    Family-Air:usr root# edge-impulse-daemon
    /usr/local/lib/node_modules/edge-impulse-cli/node_modules/bindings/bindings.js:135
    throw err;
    ^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/Debug/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/Release/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/out/Debug/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/Debug/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/out/Release/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/Release/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/default/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/compiled/12.18.0/darwin/x64/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/release/install-root/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/debug/install-root/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/default/install-root/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/lib/binding/node-v72-darwin-x64/bindings.node
at bindings (/usr/local/lib/node_modules/edge-impulse-cli/node_modules/bindings/bindings.js:126:9)
at Object. (/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/lib/darwin.js:2:36)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/lib/index.js:10:22)
at Module._compile (internal/modules/cjs/loader.js:1138:30) {
tries: [
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/Debug/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/Release/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/out/Debug/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/Debug/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/out/Release/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/Release/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/default/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/compiled/12.18.0/darwin/x64/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/release/install-root/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/debug/install-root/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/default/install-root/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/lib/binding/node-v72-darwin-x64/bindings.node’
]
}
Family-Air:usr root#

@StefanW, why are you install TypeScript? Our packages are already compiled when installing from npm, so this should not be required.

Could you just run:

$ npm install -g edge-impulse-cli@latest @serialport/terminal

And post the output?

@janjongboom this is what I get:

Family-Air:usr root# npm install -g edge-impulse-cli@latest @serialport/terminal

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

/usr/local/bin/serialport-terminal -> /usr/local/lib/node_modules/@serialport/terminal/lib/index.js

/usr/local/bin/edge-impulse-uploader -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/uploader.js

/usr/local/bin/edge-impulse-daemon -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/daemon.js

/usr/local/bin/eta-flash-tool -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/eta-flash-tool/flashtool.js

/usr/local/bin/edge-impulse-data-forwarder -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/data-forwarder.js

npm WARN tsargs@1.4.0 requires a peer of typescript@^3.1.6 but none is installed. You must install peer dependencies yourself.

  • edge-impulse-cli@1.7.0

  • @serialport/terminal@9.0.0

updated 2 packages in 14.094s

Family-Air:usr root#

@StefanW, that looks decent. Can you try this:

$ npm uninstall -g edge-impulse-cli
$ npm install -g edge-impulse-cli
$ edge-impulse-daemon

That should rebuild the dependencies.

@janjongboom, I did as you suggested. Please note I am logged in as root already. Not sure why I get this “permission denied” messages.

Family-Air:bin root# npm uninstall -g edge-impulse-cli

removed 259 packages in 3.203s

Family-Air:bin root# npm install -g edge-impulse-cli

npm WARN deprecated request@2.88.2: request has been deprecated, see … (removed)

/usr/local/bin/edge-impulse-uploader -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/uploader.js

/usr/local/bin/edge-impulse-daemon -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/daemon.js

/usr/local/bin/eta-flash-tool -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/eta-flash-tool/flashtool.js

/usr/local/bin/edge-impulse-data-forwarder -> /usr/local/lib/node_modules/edge-impulse-cli/build/cli/data-forwarder.js

@serialport/bindings@8.0.8 install /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings

prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild

prebuild-install WARN install EACCES: permission denied, access ‘/var/root/.npm’

gyp WARN EACCES current user (“nobody”) does not have permission to access the dev dir “/var/root/Library/Caches/node-gyp/12.18.0”

gyp WARN EACCES attempting to reinstall using temporary dev dir “/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/.node-gyp”

gyp WARN install got an error, rolling back install

gyp WARN install got an error, rolling back install

gyp ERR! configure error

gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/.node-gyp’

gyp ERR! System Darwin 19.3.0

gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”

gyp ERR! cwd /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings

gyp ERR! node -v v12.18.0

gyp ERR! node-gyp -v v5.1.0

gyp ERR! not ok

npm WARN tsargs@1.4.0 requires a peer of typescript@^3.1.6 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE

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.

npm ERR! A complete log of this run can be found in:

npm ERR! /var/root/.npm/_logs/2020-07-03T14_00_32_555Z-debug.log

Family-Air:bin root#

so again: this is where I end up when using edge-impulse-daemon:

Family-Air:/ root# edge-impulse-daemon
/usr/local/lib/node_modules/edge-impulse-cli/node_modules/bindings/bindings.js:135
throw err;
^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/Debug/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/Release/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/out/Debug/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/Debug/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/out/Release/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/Release/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/default/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/compiled/12.18.0/darwin/x64/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/release/install-root/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/debug/install-root/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/default/install-root/bindings.node
→ /usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/lib/binding/node-v72-darwin-x64/bindings.node
at bindings (/usr/local/lib/node_modules/edge-impulse-cli/node_modules/bindings/bindings.js:126:9)
at Object. (/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/lib/darwin.js:2:36)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/lib/index.js:10:22)
at Module._compile (internal/modules/cjs/loader.js:1138:30) {
tries: [
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/Debug/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/Release/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/out/Debug/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/Debug/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/out/Release/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/Release/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/default/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/compiled/12.18.0/darwin/x64/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/release/install-root/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/debug/install-root/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/addon-build/default/install-root/bindings.node’,
‘/usr/local/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/lib/binding/node-v72-darwin-x64/bindings.node’
]
}

This folder is not owned by you which is probably not what you want. You can try to claim ownership via:

sudo chown -R $USER /usr/local/lib/node_modules

And retry…

I tried installing on ubuntu 20.04
I think cannot sudo npm install?
To install as user i had to
sudo chown -R $USER /usr/local/bin
sudo chown -R $USER /usr/local/lib

@wroberts thanks for letting us know. The permission system on Ubuntu for Node packages still baffles me a bit. I’d assume /usr/local would always be owned by the current user, but apparently not really.