Particle-cli update fails on MacOS 10.13.6 due to python version?

I am trying to update the particle-cli to version 1.35.1, as I have been instructed (by the cli). However, using the command npm install -g particle-cli, the update fails due using the wrong python version…? The trace is:

prebuild-install WARN install No prebuilt binaries found (target=10.8.0 runtime=node arch=x64 platform=darwin)
gyp ERR! configure error 
gyp ERR! stack Error: Python executable "/Users/davidhagan/.pyenv/shims/python" is v3.6.5, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at PythonFinder.failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:501:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:14)
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:279:7)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at (internal/child_process.js:381:11)
gyp ERR! stack     at Socket.emit (events.js:182:13)
gyp ERR! stack     at Pipe._handle.close (net.js:599:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/10.8.0/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/particle-cli/node_modules/serialport
gyp ERR! node -v v10.8.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
npm ERR! errno 1
npm ERR! serialport@6.2.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the serialport@6.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Currently have installed:

  • node v10.8.0
  • npm v6.3.0
  • python v3.6.5

Are there any restrictions on which versions can be used to build the CLI? I didn’t see any listed in the “known issues” section of the readme…

Mac? Windows? Linux? I am on a Mac node v8.12.0 npm v6.4.1, and Python 3.6.1 without issues. If you are on a mac, you should have python 2.7 installed at /usr/local/python (verify by typing “python --version”, and followed by “which python”). if so, you could try redirecting npm to legacy python with:

npm config set python /usr/bin/python

1 Like

Have you tried the ol’ reliable?

Yea, that still failed with the same issue unfortunately…

1 Like

Thanks! I was trying to avoid using legacy python, but it seems that is the easiest and most straight-forward way of solving this issue. Thank you!