Particle-cli - Mac

I was making MARS Rover. Spending time messing round. Making Reboot.
Uninstall Particle-Cli and install the latest Node JS

npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/inquirer/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/particle-api-js/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/request/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/string-width/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/wrap-ansi/node_modules
npm ERR! path /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander' }
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/xxxxx/.npm/_logs/2017-07-08T08_49_07_031Z-debug.log

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

and sudo npm install -g particle-cli

$ particle
-bash: particle: command not found

What OS are you running on?

macOS Sierra 10.12.5.

You might need to follow this tutorial to fix the npm issue: https://docs.npmjs.com/getting-started/fixing-npm-permissions

1 Like

Have you tried:

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

This always works for me.

4 Likes

The thing that worked for me:

Use Homebrew to install node, then the command from @nrobinson2000

Michaels-MacBook-Pro:~ Mike$ brew install node
Updating Homebrew…
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core, caskroom/cask).
==> Updated Formulae
ammonite-repl flake8 imagemagick rakudo-star whois
assimp gnupg imagemagick@6 suite-sparse
bind gnupg@1.4 paket terragrunt
caddy gnuplot pgbadger typescript
ffmpeg heroku planck vips

Warning: node 8.2.1 is already installed
Michaels-MacBook-Pro:~ Mike$ particle
! 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.1/darwin/x64/serialport.node
Please reinstall the CLI again using npm install -g particle-cli
Michaels-MacBook-Pro:~ Mike$ sudo npm install -g --unsafe-perm node-pre-gyp npm serialport particle-cli
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/serialport-list -> /usr/local/lib/node_modules/serialport/bin/serialport-list.js
/usr/local/bin/serialport-term -> /usr/local/lib/node_modules/serialport/bin/serialport-terminal.js
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js

serialport@4.0.7 install /usr/local/lib/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/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.11.1 | darwin | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for “/usr/local/lib/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 http 200 https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-darwin-x64.tar.gz
node-pre-gyp info install unpacking .deps/
node-pre-gyp info install unpacking .deps/Release/
node-pre-gyp info install unpacking .deps/Release/obj.target/
node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/
node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/src/
node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/src/serialport.o.d
node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/src/serialport_poller.o.d
node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/src/serialport_unix.o.d
node-pre-gyp info install unpacking .deps/Release/serialport.node.d
node-pre-gyp info install unpacking obj.target/
node-pre-gyp info install unpacking obj.target/serialport/
node-pre-gyp info install unpacking obj.target/serialport/src/
node-pre-gyp info install unpacking obj.target/serialport/src/serialport.o
node-pre-gyp info install unpacking obj.target/serialport/src/serialport_poller.o
node-pre-gyp info install unpacking obj.target/serialport/src/serialport_unix.o
node-pre-gyp info install unpacking serialport.node
node-pre-gyp info tarball done parsing tarball
node-pre-gyp info validate Running test command: ‘/usr/local/bin/node --eval ‘require(’/usr/local/lib/node_modules/serialport/build/Release/serialport.node’)’’
[serialport] Success: “/usr/local/lib/node_modules/serialport/build/Release/serialport.node” is installed via remote
node-pre-gyp info ok

  • node-pre-gyp@0.6.36
  • npm@5.3.0
  • serialport@4.0.7
  • particle-cli@1.23.1
    added 137 packages, removed 249 packages, updated 105 packages and moved 7 packages in 25.806s
    Michaels-MacBook-Pro:~ Mike$ particle

Welcome to the Particle Command line utility!
Version 1.23.1
https://github.com/spark/particle-cli

Usage: particle <command_name>
Common Commands:

setup, list, call, get, device, identify, flash, subscribe
compile, monitor, login, logout, help, library

Less Common Commands:
token, binary, cloud, config, function, keys, serial, udp
update, variable, webhook, wireless

For more information Run: particle help <command_name>

Michaels-MacBook-Pro:~ Mike$

1 Like