Fail installing CLI with "npm install" command [SOLVED]

Hi all,

I tried to install the CLI using npm install -g particle-cli as explained on the official tutorial here, but then everything when crazy :dizzy_face: :

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js

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

node-pre-gyp ERR! Tried to download: https://github.com/voodootikigod/node-serialport/releases/download/3.1.2/serialport-v3.1.2-node-v51-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport@3.1.2 and node@7.3.0 (node-v51 ABI) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Python executable "/Users/manitoba/miniconda3/bin/python" is v3.5.2, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:454:14)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:443:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:202:7)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:885:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:334:11)
gyp ERR! stack     at emitOne (events.js:96:13)
gyp ERR! stack     at Socket.emit (events.js:188:7)
gyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:501:12)
gyp ERR! System Darwin 16.3.0
gyp ERR! command "/usr/local/Cellar/node/7.3.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release"
gyp ERR! cwd /usr/local/lib/node_modules/particle-cli/node_modules/serialport
gyp ERR! node -v v7.3.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/7.3.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:885:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Darwin 16.3.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/7.3.0/bin/node" "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/particle-cli/node_modules/serialport
node-pre-gyp ERR! node -v v7.3.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.28
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/7.3.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release' (1)
/usr/local/lib
└── (empty)

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/7.3.0/bin/node" "/usr/local/bin/npm" "install" "-g" "particle-cli"
npm ERR! node v7.3.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! serialport@3.1.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@3.1.2 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs serialport
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/manitoba/npm-debug.log
npm ERR! code 1

I’m using macOS 10.12.2, npm 3.10.10 & node 7.3.0, and zsh instead of bash, although I don’t think this could trigger any issue here.

  • particle command
    As asked here, I checked but the particle command doesn’t work. So I’m guessing nothing got actually installed, right?

  • Python
    With the following lines

    gyp ERR! stack Error: Python executable ā€œ/Users/manitoba/miniconda3/bin/pythonā€ is v3.5.2, which is not supported by gyp.
    gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.

I’m guessing that there’s something going on with Python, am I right?

  • Serial port
    It looks like serial port v. 3.1.2 install failed maybe because of node.js and npm not being the latest versions installed. I upgraded both of them, yet still having the same issue.

  • The Author
    You can see this suggestion toward the end of the log:

    Tell the author that this fails on your system:
    npm ERR! node-pre-gyp install --fallback-to-build

Well, no idea who ā€œthe authorā€ is, but if you happen to know him, tell him that I’d pay him a :coffee: in exchange of some help…

The rest of the log is pretty much chinese and turkish insults mixed together for me. I’d really appreciate any kind of input :disappointed_relieved:

It seems that your node & NPM versions are so new that there are no pre-compiled serial-port packages available yet. It then tries to compile that on its own, for which it uses gyp. Gyp apparently doesn’t like Python 3.x, which isn’t backwards compatible with 2.x.
Taking the above into consideration, could your try installing Python 2.x first? Then give the installation another shot.

1 Like

Thanks, this is what I was actually doing after I finally figured out some of the log details. I’ll update the post with the results. Thanks again!

Hi all, well just to close this by saying that I managed to install the particle cli.
I didn’t uninstall Python 3. I used miniconda3 and the following command to install Python 2.7:

conda create -n py27 python=2.7 anaconda

Then, the source activate py27 command switched my entire system to Python 2.7.

Node.js was not supported either, so I installed n, a version management for Node.js, and activated a stable version of Node supported by the Particle CLI through the n 5.11.0 command.

Thanks for the input!

1 Like