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:
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, 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
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.
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.