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

Po-util always downloads the most latest version of node due to its futureproofing features. It makes sense that serialport would not be working. Should I change Po-util so that it installs the second or third latest version of node so that serialport would be caught up?

However on Travis CI, using node 6.9.1 it installed successfully. https://travis-ci.org/nrobinson2000/po-util/jobs/170256350

Serialport will try to compile itself for unsupported versions for node and I expect Travis to have a C compiler installed.

You can pin a version of node in poutil that you know works, and update later.

Version 7.0.0 works too

https://travis-ci.org/nrobinson2000/po-util/jobs/170487551

Is it because @jeffpeakmonitor needs a c compiler?

I downgraded to 6.8.0 but same error.

Well 6.9.1 is the new LTS so I guess I could go with that?

@jvanier
I rolled back to v6.9.1 for po-util and was able to reinstall on my Yosemite Mac.

Here was the main problem I got using v7.0.0:

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/nrobinson/.node-gyp/7.0.0"

Installing the CLI doesn’t need a compiler, but in some cases it seems the node package manager (npm) can’t figure out which pre-compiled version of serialport to use so it falls back to trying to compile it. So in those cases having a compiler will allow installation to proceed but it shouldn’t fall back to compiling in the first place.

Pardon this newbie Q, particularly since I’m not sure how to interpret the discussion above : (

When I install the particle cli on my mac, I get:

“deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue”

I’m using:

OSX El Capitan v 10.11.6
Node.js v6.9.3
npm v3.10.10

And when I login I get:

“Error loading command /usr/local/lib/node_modules/particle-cli/commands/SerialCommand.js Error: Module version mismatch. Expected 48, got 46.”

Is that something I can fix, or should I just ignore it?

Thanks, DC

This is not an error.

This however is a bug with the serialport package. It can be fixed by doing:

$ sudo npm install -g node-pre-gyp serialport particle-cli
1 Like

Thanks! Looks like it worked! Appreciate it. :grinning:

1 Like

Hey I'm running Sierra 10.12.6
I've spent the last couple of days trying to figure out issues with serialport mismatch and trying various ways to get the particle CLI up and running, to no avail.
Here is a compiled list of references that I seemed to circle back to:

https://community.particle.io/t/particle-cli-issues-error-loading-module-serialport/32239/6
https://docs.npmjs.com/getting-started/fixing-npm-permissions

I am having a similar issue as a lot of people and getting hung up on weird dependency/permission/PATH/mismatch issues. So to retry everything again I decided to install po-util in hopes that it would build everything as needed and I could finally finish up some projects. Here are my steps and the resulting error. It seems like I'm really close to fixing this.

  1. I cleaned node and npm from my computer
  2. I installed po-util via bash <(curl -sL https://master.po-util.com/install)

After installing I got this output (this is the same output I just reran it because I didn't grab the error the first time)
Davids-MacBook-Pro:~ daviddefilippis$ po install

Installing Particle firmware from Github...
fatal: destination path 'firmware' already exists and is not an empty directory.

Installing RedBear Duo firmware from Github...
fatal: destination path 'firmware' already exists and is not an empty directory.

Installing ARM toolchain...
Already up-to-date.
Warning: nrobinson2000/po/gcc-arm-none-eabi-53 20160330 is already installed
Warning: dfu-util 0.9 is already installed

Node.js version v6.9.1 is already installed.

Installing particle-cli...
Password:
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/node-pre-gyp -> /usr/local/lib/node_modules/node-pre-gyp/bin/node-pre-gyp
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js
/usr/local/bin/serialport-list -> /usr/local/lib/node_modules/serialport/bin/list.js
/usr/local/bin/serialport-term -> /usr/local/lib/node_modules/serialport/bin/terminal.js
/usr/local/bin/serialport-repl -> /usr/local/lib/node_modules/serialport/bin/repl.js

serialport@5.0.0 install /usr/local/lib/node_modules/serialport
node-pre-gyp install --fallback-to-build

[serialport] Success: "/usr/local/lib/node_modules/serialport/build/Release/serialport.node" is installed via remote

  • node-pre-gyp@0.6.38

  • npm@5.4.2

  • particle-cli@1.24.1

  • serialport@5.0.0
    updated 4 packages in 26.882s

    Thank you for installing po-util. Be sure to check out https://po-util.com
    if you have any questions, suggestions, comments, or problems. You can use
    the message button in the bottom right corner of the site to send me a
    message. If you need to update po-util just run "po update" to download
    the latest versions of po-util, Particle Firmware and particle-cli, or run
    "po install" to update all dependencies.

Davids-MacBook-Pro:~ daviddefilippis$ particle cloud login
module.js:471
throw err;
^

Error: Cannot find module 'xtend'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/particle-cli/settings.js:31:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Davids-MacBook-Pro:~ daviddefilippis$

New error but can you
a) point me in the right direction to chase this error down
b) help point me to a resource that will wipe node and po-util and all dependencies so that I can start fresh

thanks

  • npm uninstall -g particle-cli
  • Check that particle command no longer works
  • If it does, do a which particle and delete the binary
  • Re install using npm install -g particle-cli

@kennethlimcp thanks for the quick response here is the output from your directions

Davids-MacBook-Pro:~ daviddefilippis$ sudo npm uninstall -g particle-cli
Password:
removed 538 packages in 5.705s
Davids-MacBook-Pro:~ daviddefilippis$ particle login
-bash: /usr/local/bin/particle: No such file or directory
Davids-MacBook-Pro:~ daviddefilippis$ sudo npm install -g particle-cli
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js

serialport@4.0.7 install /usr/local/lib/node_modules/particle-cli/node_modules/serialport
node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/usr/local/bin/node',
node-pre-gyp verb cli '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using node-pre-gyp@0.6.32
node-pre-gyp info using node@6.9.1 | darwin | x64
node-pre-gyp verb command install
node-pre-gyp info check checked for "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node" (not found)
node-pre-gyp http GET https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.7 and node@6.9.1 (node-v48 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http EACCES: permission denied, mkdir '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build'
node-pre-gyp verb command build [ 'rebuild' ]
node-pre-gyp http 200 https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-darwin-x64.tar.gz
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/daviddefilippis/.node-gyp/6.9.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp/6.9.1"

and the reinstall attempt, permissions error loop goes on forever.

Checking the permissions for either of the directories that are throwing the error yeilds

Davids-MacBook-Pro:~ daviddefilippis$ ls -l /usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp/6.9.1
ls: /usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp/6.9.1: No such file or directory
Davids-MacBook-Pro:~ daviddefilippis$ ls -l /usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp
ls: /usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp: No such file or directory
Davids-MacBook-Pro:~ daviddefilippis$

I was thinking I could edit the permissions but the directories don't exist (I'm thinking a failed install rolls back)
This issue seems like it is rooted in compatibility problems with serialport
again, thanks for all the help

Try installing with sudo npm install -g particle-cli

did that
command breakdown from my last post:

sudo npm uninstall -g particle-cli
particle login[quote=“daviddefilippis, post:33, topic:24191”]
sudo npm install -g particle-cli
[/quote]

ls -l /usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp/6.9.1
ls -l /usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp

For giggles I cpj’d [quote=“kennethlimcp, post:34, topic:24191”]
sudo npm install -g particle-cli
[/quote]

and got this:
Davids-MacBook-Pro:~ daviddefilippis$ sudo npm install -g particle-cli
Password:
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js

  • particle-cli@1.24.1
    updated 1 package in 9.697s

looks good so I tried:

Davids-MacBook-Pro:~ daviddefilippis$ particle login
! Error loading module ‘serialport’: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Debug/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/out/Debug/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/Debug/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/out/Release/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/Release/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/default/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/compiled/6.9.1/darwin/x64/serialport.node
Please reinstall the CLI again using npm install -g particle-cli
Davids-MacBook-Pro:~ daviddefilippis$

kinda back to where I started.

thanks for all the hand holding @kennethlimcp

Following the instructions from the terminal output to “reinstall the CLI using npm install -g particle-cli”

Davids-MacBook-Pro:~ daviddefilippis$ npm install -g particle-cli
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/particle-cli
npm ERR! path /usr/local/lib/node_modules/particle-cli
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/particle-cli’
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/particle-cli’
npm ERR! at Error (native)
npm ERR! stack: ‘Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules/particle-cli’\n at Error (native)’,
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/usr/local/lib/node_modules/particle-cli’ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/daviddefilippis/.npm/_logs/2017-10-03T15_32_03_311Z-debug.log

got an access error so I re-ran the command with sudo

Davids-MacBook-Pro:~ daviddefilippis$ sudo npm install -g particle-cli
Password:
Sorry, try again.
Password:
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js

  • particle-cli@1.24.1
    updated 1 package in 5.948s
    Davids-MacBook-Pro:~ daviddefilippis$ particle cloud login
    ! Error loading module ‘serialport’: Could not locate the bindings file. Tried:
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/serialport.node
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Debug/serialport.node
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/out/Debug/serialport.node
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/Debug/serialport.node
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/out/Release/serialport.node
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/Release/serialport.node
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/default/serialport.node
    → /usr/local/lib/node_modules/particle-cli/node_modules/serialport/compiled/6.9.1/darwin/x64/serialport.node
    Please reinstall the CLI again using npm install -g particle-cli
    Davids-MacBook-Pro:~ daviddefilippis$

Looped back to start.

Hey @daviddefilippis, I'm Nathan and po-util is my project.

When installing particle-cli, po-util uses:

sudo npm install -g --unsafe-perm node-pre-gyp npm serialport particle-cli

I've found sudo and --unsafe-perm to be almost always required.

I haven't experienced this issue yet.

Cool, thanks for the heads up. How does this output look to you (or compared to your tests)?
I just threw in the po install command to see what happened and get the versions of some of the more important packages

Davids-MacBook-Pro:~ daviddefilippis$ po install

Installing Particle firmware from Github...
fatal: destination path 'firmware' already exists and is not an empty directory.

Installing RedBear Duo firmware from Github...
fatal: destination path 'firmware' already exists and is not an empty directory.

Installing ARM toolchain...
Updated 1 tap (homebrew/core).
==> Updated Formulae
ansible-lint efl hg-fast-export libuv poppler
botan erlang httpd nexus pqiv
buildifier evince icdiff p11-kit qemu
ccm fonttools imagemagick paket quex
convox freetds imagemagick@6 pdf2svg snap7
cutter gjs kawa pdfgrep vdirsyncer
diff-pdf glib launch pdftoedn vips
dnsviz gphoto2 libgphoto2 pdftoipe virtualpg
dspdfviewer grpc libqalculate planck xtensor
Warning: nrobinson2000/po/gcc-arm-none-eabi-53 20160330 is already installed
Warning: dfu-util 0.9 is already installed

Node.js version v6.9.1 is already installed.

Installing particle-cli...
Password:
Sorry, try again.
Password:
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/node-pre-gyp -> /usr/local/lib/node_modules/node-pre-gyp/bin/node-pre-gyp
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js
/usr/local/bin/serialport-repl -> /usr/local/lib/node_modules/serialport/bin/repl.js
/usr/local/bin/serialport-term -> /usr/local/lib/node_modules/serialport/bin/terminal.js
/usr/local/bin/serialport-list -> /usr/local/lib/node_modules/serialport/bin/list.js

serialport@5.0.0 install /usr/local/lib/node_modules/serialport
node-pre-gyp install --fallback-to-build

[serialport] Success: "/usr/local/lib/node_modules/serialport/build/Release/serialport.node" is installed via remote

  • node-pre-gyp@0.6.38

  • serialport@5.0.0

  • npm@5.4.2

  • particle-cli@1.24.1
    updated 4 packages in 20.871s

    Thank you for installing po-util. Be sure to check out https://po-util.com
    if you have any questions, suggestions, comments, or problems. You can use
    the message button in the bottom right corner of the site to send me a
    message. If you need to update po-util just run "po update" to download
    the latest versions of po-util, Particle Firmware and particle-cli, or run
    "po install" to update all dependencies.

Davids-MacBook-Pro:~ daviddefilippis$

after the po install command there is an output line that reads:

Trying to interact with the particle cli yeilds:

Davids-MacBook-Pro:~ daviddefilippis$ particle login
! Error loading module 'serialport': Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Debug/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/out/Debug/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/Debug/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/out/Release/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/Release/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/default/serialport.node
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/compiled/6.9.1/darwin/x64/serialport.node
Please reinstall the CLI again using npm install -g particle-cli
Davids-MacBook-Pro:~ daviddefilippis$

The 3rd line in the error output is:

! Error loading module 'serialport': Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node

and po install output was:

Success: "/usr/local/lib/node_modules/serialport/build/Release/serialport.node" is installed via remote

Should I move files around or try and link directories?

I just uninstalled and reinstalled particle-cli and got this message regarding serialport:

[serialport] Success: "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node" is installed via remote

Here’s what I did:

sudo npm uninstall -g --unsafe-perm particle-cli serialport node-pre-gyp
sudo npm install -g --unsafe-perm particle-cli

After doing this particle-cli is working fine.

1 Like