Npm install particle-cli not working on mac os x el capitan

Hi,

I have the following setup:
Mac OS X: El Capitan 10.11.15
Node: v4.4.7
and npm: 2.15.8

I tried to install particle-cli using the command:
sudo npm install -g particle-cli

This gave me a whole bunch of error messages:
How can I upload the npm-debug.log on here?

Apologies for the long list of error messages on here and Thanks in advance for your help and guidance.

Password:
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
-
> serialport@3.1.2 install /usr/local/lib/node_modules/particle-cli/node_modules/serialport
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://github.com/voodootikigod/node-serialport/releases/download/3.1.2/serialport-v3.1.2-node-v46-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for serialport@3.1.2 and node@4.4.7 (node-v46 ABI) (falling back to source compile with node-gyp) 
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/temp/.node-gyp/4.4.7"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp"
make: *** No rule to make target `../.node-gyp/4.4.7/include/node/common.gypi', needed by `Makefile'.  Stop.
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:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release"
gyp ERR! cwd /usr/local/lib/node_modules/particle-cli/node_modules/serialport
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:827:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 15.5.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/particle-cli/node_modules/serialport
node-pre-gyp ERR! node -v v4.4.7
node-pre-gyp ERR! node-pre-gyp -v v0.6.28
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release' (1)
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "particle-cli"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code ELIFECYCLE

npm ERR! serialport@3.1.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the serialport@3.1.2 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs serialport
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/temp/npm-debug.log

Not sure if itā€™s a permissions issues but you can try fixing it with the instructions: https://docs.npmjs.com/getting-started/fixing-npm-permissions

This is documented here: https://docs.particle.io/guide/tools-and-features/cli#installing

I followed the below steps:

  • I uninstalled Node v.4.4.7 using the instructions in the website How
    to completely uninstall node.js
  • I reinstalled Node v6.3.0 using
    the instructions in the website Installing node.js on El Capitan
  • Then I ran ā€œnpm install -g particle-cliā€ and I still got a bunch of EACCES errors but much fewer than when running Node v.4.4.7
  • I ran the commands for ā€œOption 1: Change the permission to npmā€™s default directoryā€ from the website
  • All errors went away and installed fine except 1 warning ā€œnpm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issueā€
  • testing particle login worked fine

Question:

  • How do I get rid of the minimatch warning? Will it give me issues later on?

Same problem here, but fixes not working. Why isnā€™t there a nice tidy installer for particle-cli? I donā€™t want to screw up my work Mac changing permissions in the usr directory

@jeffpeakmonitor
I would recommend trying po-util. It not only installs particle-cli for you, but it also makes it easy to develop locally.

@piyushraju
The minimatch warning can be safely ignored.

Also on mac, you must always use sudo if you are going to npm install -g something.

po-util looks perfect! Thank you.

1 Like

However, no luck. Iā€™ve installed the latest X-Code, and then po-util. Still getting this:

serialport@3.1.2 install: node-pre-gyp install --fallback-to-build
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the serialport@3.1.2 install script ā€˜node-pre-gyp install --fallback-to-buildā€™.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs serialport
npm ERR! Or if that isnā€™t available, you can get their info via:
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.

Is that from installing po-util? That really shouldnā€™t happpen. Also, what version of MacOS are you on? Po-util does not require Xcode because Homebrew gets all of the required tools for you.

Thanks for the help!

OSX 10.11.6

That was the same series of errors I got before using po-util, so I donā€™t think itā€™s related.

Weird. I have tested po-util on a ā€œfreshā€ El Capitan and never had this error.

What versions of node and npm do you have installed?

You should have the latest versions (thanks to po-util being futureproof) but you can check with:

node -v

and

npm -v

Edit:
My CI actually uses El Capitan and has no errors. https://travis-ci.org/nrobinson2000/po-util/jobs/170256350

Node is v6.9.1
NPM is 3.10.9

Hmmm. You have the latest versions. I donā€™t know why it is failing. Did you mess with your Mac earlier?

Iā€™m having issues with using the Windows CLI installer lately also, and I have no idea if these problems could be related but I figured I would throw this out there.

@jvanier Is digging into the issue now.

I had the CLI & Dev working on this laptop at one time but then I started getting unexpected Token errors for some reason.

They probably are not related but who knows :smiley:

1 Like

It would only be related if serialport was the culprit.

Haha, well, yes I have programmed some Arduinos and ESP8266ā€™s, and installed their utilities. Nothing more that that however. I see other people in this and other threads had the same error but were able to fix it by chown of their /usr folder, which I hesitate to do because there is another user on this computer that I need to keep working.

I have Photons as well but have always programmed with the build.particle.io. I would like to save data and use USB to program an Electron, hence the desire to install the cli.

Again I appreciate your help

I really donā€™t think that chowning your /usr would help this problem.

What if you try option 2?

https://docs.npmjs.com/getting-started/fixing-npm-permissions

I tried option 2, same error.

That serialport module has been problematic for many people. The root of your issue @jeffpeakmonitor is that the node version on your machine is too new and serialport has not been updated to support it yet. That happens every time a new version of node is releasedā€¦

If you had a slightly older version of node like 6.8.0 or earlier the CLI would install properly.

Iā€™m working on a fix for this.

1 Like