Tutorial: Particle-cli on Mac OSX [26 Sep 2015]

definitely :wink:

1 Like

Oh my god yes!!! @kennethlimcp you are a savior! One more big hurdle down. Thank you so much. I greatly appreciate it. Happy Friday to you.

Hi @kennethlimcp Thank you in advance on your tutorial and help!

I am very new to Node and working on iTerm. I tried the command _sudo npm install -g serialport looked like installed successfully - I got

> [serialport] Success: "/usr/local/lib/node_modules/serialport/build/Release/serialport.node" is installed via remote
> /usr/local/lib
> └── serialport@5.0.0

Then I ran the command sudo npm install -g particle-cli (btw, what's the difference between sudo npm install -g particle-cli and sudo npm install particle-cli?)

I received three warnings first:
> npm WARN excluding symbolic link test/server/static/ie8-polyfill.js -> ../../../ie8-polyfill.js
> npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
> npm WARN excluding symbolic link test/server/static/ie8-polyfill.js -> ../../../ie8-polyfill.js
> /usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js

then some successful-ish response:

 serialport@4.0.7 install /usr/local/lib/node_modules/particle-cli/node_modules/serialport
    node-pre-gyp install --fallback-to-build
[serialport] Success: "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node" is installed via remote

spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/particle-cli/node_modules/spawn-sync
node postinstall

Then there was a long tree response.

Was this installation successful? What those warnings mean?

My Node.js is v6.11.2
My Macbook is Sierra, Version 10.12.1

Thank you!
Manlin

Hii @kennethlimcp

I tried couple more times and got:

npm WARN excluding symbolic link test/server/static/ie8-polyfill.js -> ../../../ie8-polyfill.js
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
/usr/local/lib
└── particle-cli@1.23.1

What does it mean? Thank you!!

To check that it is properly installed, you can try the command particle --version.

The -g used in npm install stands for global so that package installed can be called anywhere in the Terminal instead of just the directory you are in.

it showed up 1.23.1 after i ran the command particle --version
guess CLI is installed?

yup.

1 Like

thank you @kennethlimcp!!

Just adding this for reference. I’ve always been able to install particle-cli with the following:

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

Hi guys,
I'm having a problem getting the CLI to work again. It worked for me 6 months ago, but seemed to need a bunch of updating.
I updated Node, current version is 6.11.5
I updated NPM, current version is 5.5.1
I've tried updating particle CLI, and last time it looked like it worked, but when I check the particle version, it has trouble and asks me to do it again.
If I use the command "npm install -g particle-cli"
nothing changes.

Below is what I get when I ask for the particle version:

$ particle -v
! 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.11.5/darwin/x64/serialport.node
Please reinstall the CLI again using npm install -g particle-cli
$

Any ideas?

Mac OS Sierra High…:sweat:
Still works on Mac OS Sierra.

Sorry, didn’t mention that,
I’m using OS X 10.11.6

OK, so Im still running circles here, I uninstalled everything, but get the following errors when I install the CLI:

@ParticleIce am I not going to be able to make it work with my OS X version?

Anyone else have any input??

Thx
J

$ 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/jimlivingston/.npm/_logs/2017-10-28T18_21_59_040Z-debug.log
$

Don’t format the hard drive. Apple is sneaky to upgrade Mac Sierra High on Netboot.

try to reinstall it and downgrade Node and NPM version that works.

Try
$sudo npm install -g particle-cli

What do you have?

@jimbol,

Try:

sudo npm install -g --unsafe-perm npm particle-cli

EDIT:
It’s important that you include --unsafe-perm

Thanks, but still no luck.
after I do that, I still have the following when I "particle -v"

$ particle -v
! 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.11.5/darwin/x64/serialport.node
Please reinstall the CLI again using npm install -g particle-cli
$

I remember someone having this error before.

OK,
I’m not sure exactly what did it, but I kept uninstalling, updating, and reinstalling, and eventually got there.
I did an OSX update to latest version, brew install of Node, sudo install of the CLI, and finally it works.
It seems like I had to do everything 3 times, and I’m not sure what was different in the final working install process, but it’s going.
Thanks all for the help.
J

How to install dfu-util without Homebrew or MacPorts?