Twitter

Category “hardware”

Particle CLI Install Error

I’ve been tinkering with Particle’s Photon boards, and figured I’d give their CLI a try. Unfortunately, on running their install with npm install -g particle-cli, I started receiving the following error:

gyp ERR! build error
 gyp ERR! stack Error: make failed with exit code: 2
 gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
 gyp ERR! stack     at ChildProcess.emit (events.js:188:13)
 gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
 gyp ERR! System Darwin 18.2.0
 gyp ERR! command "/usr/local/Cellar/node/11.6.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 v11.6.0
 gyp ERR! node-gyp -v v3.8.0
 gyp ERR! not ok
 npm ERR! code ELIFECYCLE
 npm ERR! errno 1
 npm ERR! [email protected] install: prebuild-install || node-gyp rebuild
 npm ERR! Exit status 1

After looking around online, uninstalling/reinstalling Homebrew, Node, etc, I still got nowhere. Figuring it had something to do with my recent swap to a new Mac, I started poking around forums for path issues and finally found this.

The solution in the link is simple. Go to your profile (vi ~/.bash_profile for most people) and enter the following:

if [ -d "$HOME/bin" ] ; then
     PATH="$HOME/bin:$PATH"
 fi

Save the file and reload your profile using source ~/.profile

This took care of the problem for me!


Jay Margalus is on Twitter at @jaymargalus