[Resolved] Particle CLI incompatible with Node 4.X

I recently received a troubleshooting email from a customer with the following error when trying to install the Particle CLI on a Mac with Node 4.1:

npm install -g particle-cli yielded the following:
https://gist.github.com/emilyrose/a97c424cf040927fe8d8

As you can see, there’s an incompatibility between the expected version of Node (0.10.x — 0.12.x) and the installed version 4.1.0. This points to a known issue in a Node module used by the Particle CLI, which is not currently compatible with Node 4.x. If you’re having this issue and can’t install the Particle CLI, there are two possible ways to remedy the situation:

1. Install a Version Manager!

There are several recommended version managers to choose from. Each of these tools provides a very similar functionality; allowing you to easily change which version of Node you use.

OS X & Linux

  • nvm
  • Includes “one-line install”
  • nave
  • Supports sub shells
  • n
  • Installs via npm

To install nvm, switch from Node 4.X to 0.12.7, and install the Particle CLI, for instance, simply issue the following commands:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash


####NOTE: You may be prompted with an error message that looks something like this:

                                 Dload  Upload   Total   Spent    Left  Speed
100  7728  100  7728    0     0   3833      0  0:00:02  0:00:02 --:--:--  3835
=> Downloading nvm from git to '/Users/hartwh/.nvm'
=> 

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.```

If that’s the case, you haven’t accepted the terms of the most recent Xcode, and should type the following:

sudo xcodebuild -license

Scroll to the bottom, and type accept if you agree to the terms and conditions.


Once you have nvm successfully installed, you will need to close and restart your terminal. When you create a new session, type the following to install the Particle CLI.

nvm install 0.12.7

nvm use 0.12.7

npm install -g particle-cli

Windows

Unfortunately your choices are more limited on Windows, but you can downgrade the binary by uninstalling Node 4.x, and installing Node 0.12.7 via the node-v0.12.7-x86.msi file provided on nodejs.org. You may also consider a Windows version of nvm, predictably named nvmw. This version manager has not been tested by Particle staff, so please use at your own discretion.

2. Downgrade

You may also just opt to downgrade your system-wide version of Node. This can be accomplished by downloading and installing the appropriate v0.12.7 for your system.

5 Likes

This topic is now listed. It will be displayed in topic lists.

Perfect. Very short, concise fix and it got me up and running immediately. I'm the lost Mac who couldnt' get particle-cli installed. I'm up with 1.8.3 now.

Many thanks.

Jack Rickard

Thank you. I was going CRAZY trying to figure out what was going on. It is a version issue with node, who knew?

v1.8.9 of the Particle CLI is now Node 4.x compatible!

http://npmjs.com/package/particle-cli

3 Likes

Did you mean 1.8.10? :wink:

You can type npm install -g particle-cli into your terminal to do a fresh install or simply npm update -g particle-cli to update to the latest version.

I am going to mark this thread as resolved.

1 Like

haha, well I released a couple silly changes as new versions as well just to get them published to npm. Point is, 1.8.9+ is Node 4.x compatible! :smile_cat:

1 Like