Edge Impuse CLI Installation Error

I’m trying to install Edge Impulse CLI on MacOS but I’m getting the following error :

  $     npm install -g edge-impulse-cli
    npm WARN deprecated @zeit/dockerignore@0.0.5: "@zeit/dockerignore" is no longer maintained
    npm WARN deprecated har-validator@5.1.5: this library is no longer supported
    npm WARN deprecated request-promise@4.2.4: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
    npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
    npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
    npm ERR! code 1
    npm ERR! path /Users/jp/.npm-global/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@8.3.0
    npm ERR! gyp info using node@16.13.0 | darwin | x64
    npm ERR! gyp info find Python using Python version 3.10.0 found at "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3"
    npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.10/bin/python3
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   '/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
    npm ERR! gyp info spawn args   'binding.gyp',
    npm ERR! gyp info spawn args   '-f',
    npm ERR! gyp info spawn args   'make',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/jp/.npm-global/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings/build/config.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/jp/Library/Caches/node-gyp/16.13.0/include/node/common.gypi',
    npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
    npm ERR! gyp info spawn args   '-Dvisibility=default',
    npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/jp/Library/Caches/node-gyp/16.13.0',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/jp/Library/Caches/node-gyp/16.13.0/<(target_arch)/node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/jp/.npm-global/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings',
    npm ERR! gyp info spawn args   '-Dnode_engine=v8',
    npm ERR! gyp info spawn args   '--depth=.',
    npm ERR! gyp info spawn args   '--no-parallel',
    npm ERR! gyp info spawn args   '--generator-output',
    npm ERR! gyp info spawn args   'build',
    npm ERR! gyp info spawn args   '-Goutput_dir=.'
    npm ERR! gyp info spawn args ]
    npm ERR! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
    npm ERR! 
    npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
    npm ERR! 
    npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
    npm ERR! 
    npm ERR! Traceback (most recent call last):
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1502, in XcodeVersion
    npm ERR!     version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines()
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1563, in GetStdoutQuiet
    npm ERR!     raise GypError("Error %d running %s" % (job.returncode, cmdlist[0]))
    npm ERR! gyp.common.GypError: Error 1 running xcodebuild
    npm ERR! 
    npm ERR! During handling of the above exception, another exception occurred:
    npm ERR! 
    npm ERR! Traceback (most recent call last):
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 45, in <module>
    npm ERR!     sys.exit(gyp.script_main())
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 662, in script_main
    npm ERR!     return main(sys.argv[1:])
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 654, in main
    npm ERR!     return gyp_main(args)
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 639, in gyp_main
    npm ERR!     generator.GenerateOutput(flat_list, targets, data, params)
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2455, in GenerateOutput
    npm ERR!     writer.Write(
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 830, in Write
    npm ERR!     self.WriteSources(
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1305, in WriteSources
    npm ERR!     cflags = self.xcode_settings.GetCflags(
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 662, in GetCflags
    npm ERR!     archs = self.GetActiveArchs(self.configname)
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 512, in GetActiveArchs
    npm ERR!     xcode_archs_default = GetXcodeArchsDefault()
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 119, in GetXcodeArchsDefault
    npm ERR!     xcode_version, _ = XcodeVersion()
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1513, in XcodeVersion
    npm ERR!     version = CLTVersion()  # macOS Catalina returns 11.0.0.0.1.1567737322
    npm ERR!   File "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1551, in CLTVersion
    npm ERR!     return re.search(regex, output).groupdict()["version"]
    npm ERR! AttributeError: 'NoneType' object has no attribute 'groupdict'
    npm ERR! gyp ERR! configure error 
    npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
    npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
    npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
    npm ERR! gyp ERR! System Darwin 18.7.0
    npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/jp/.npm-global/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    npm ERR! gyp ERR! cwd /Users/jp/.npm-global/lib/node_modules/edge-impulse-cli/node_modules/@serialport/bindings
    npm ERR! gyp ERR! node -v v16.13.0
    npm ERR! gyp ERR! node-gyp -v v8.3.0
    npm ERR! gyp ERR! not ok

    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/jp/.npm/_logs/2021-11-07T18_43_56_299Z-debug.log

Hi @jonathanrjpereira ,

Do you have the xcode developer tools installed? From your command line: xcode-select --install

Then try re-installing the CLI.

Let me know if this works!

1 Like

Hi jenny,

I tried this and worked for me. I have macOS Monterrey 12.3.1

After install CLI I got a few warnings/vulneravilities:

added 372 packages, and audited 373 packages in 47s

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

5 vulnerabilities (2 moderate, 3 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

I ran npm audit fix --force and got this:

npm WARN using --force Recommended protections disabled.
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap fil

So I ran npm i --package-lock-only and as result I got:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/name/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/name/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

Despites looks it did not work, I ran npm audit to check the status and magically now I have:

found 0 vulnerabilities

To double check I ran npm audit fix --force again and…

up to date, audited 1 package in 333ms

found 0 vulnerabilities

Thanks!

I am having a similar problem on my Mac. We tried the xcode install and it didn’t work, any ideas?