This worked for me:
sudo npm cache clean -f
sudo npm install -g n
sudo n 0.10.36
This worked for me:
sudo npm cache clean -f
sudo npm install -g n
sudo n 0.10.36
Found this thread after having similar errors on OSX Yosemite 10.10.5:
npm install -g particle-cli
npm WARN install:core-util-is@1.0.1 ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/particle-cli/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is' -> '/usr/local/lib/node_modules/particle-cli/node_modules/core-util-is'
[...SNIP...]
npm WARN install:strip-ansi@2.0.1 ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/particle-cli/node_modules/readline2/node_modules/strip-ansi/cli.js'
[...SNIP...]
βββ (empty)
npm ERR! code 1
However my brew was already updated previously:
brew update && brew upgrade
$ node --version
v5.0.0
$ npm --version
3.3.9
All I had to do was clean up my node cache:
npm uninstall -g particle-cli
sudo npm cache clean -f
And the install succeeded without incident:
npm install -g particle-cli
particle login
I've got the same versions yet I'm still unable to execute node-pre-gyp.
gyp ERR! cwd /usr/local/lib/node_modules/particle-cli/node_modules/serialport
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/5.0.0/bin/node /usr/local/lib/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/node-v47-darwin-x64/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/node-v47-darwin-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (/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:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 13.4.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/5.0.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 v5.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.13
node-pre-gyp ERR! not ok
Can you downgrade to nodejs v4.x.x. and try again?
What version of nodejs work with with OS X 10.10.5 ?
$ particle login gives the error -bash: particle: command not found.
My version of nodejs is :node -v : v4.2.6
V4 should work fine too. Did you notice any error installing the CLI?
The install went smoothly but the Terminal Activity cursor would keep spinning. I let it go for 2 hours and then exited the Terminal. All of the files appeared to be there (but I have no way of really knowing). How long should it take to install?
It should only take 1-2 minutes at most. Can you cancel it and try again?
npm install -g particle-cli --verbose
That did the trick! It installed properly and I was able to login. Thanks so much.
When I try to run;
sudo npm install -g particle-cli
I get the following result;
npm WARN excluding symbolic link test/server/static/ie8-polyfill.js -> ../../../ie8-polyfill.js
npm WARN deprecated node-uuid@1.4.7: 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
> serialport@4.0.7 install /usr/local/lib/node_modules/particle-cli/node_modules/serialport
> node-pre-gyp install --fallback-to-build
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
sh: node-pre-gyp: command not found
/usr/local/lib
βββ (empty)
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "particle-cli"
npm ERR! node v7.6.0
npm ERR! npm v4.3.0
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! serialport@4.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the serialport@4.0.7 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/noofny/.npm/_logs/2017-03-13T08_47_43_526Z-debug.log
node -v : 7.6.0
npm -v : 4.3.0
OSX : 10.11.6
Have tried a bunch of things suggested in this post but cannot get this thing going, Iβm clearly new to Node, can anyone please halp?!
Try doing sudo npm install -g serialport
first
Thanks, but same type of errors about permissions...
sudo npm install -g serialport
/usr/local/bin/serialport-term -> /usr/local/lib/node_modules/serialport/bin/serialport-terminal.js
/usr/local/bin/serialport-list -> /usr/local/lib/node_modules/serialport/bin/serialport-list.js
> serialport@4.0.7 install /usr/local/lib/node_modules/serialport
> node-pre-gyp install --fallback-to-build
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
sh: node-pre-gyp: command not found
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.7.2/bin/node" "/usr/local/bin/npm" "install" "-g" "serialport"
npm ERR! node v7.7.2
npm ERR! npm v4.1.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! serialport@4.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the serialport@4.0.7 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/noofny/npm-debug.log
I have literally spent hours on this, trying every suggestion from using homebrew/not and using nvm/not, trying installing the particle-cli using different versions of node/npm, deleting everything and starting clean, chmod/chown on the entire /usr/local folder and even trying to run OSX as root.
No joy.
Why is this such a disaster on OSX?
I admit I am learning, and that my patience on this particular issue has reached itβs end, so sorry for the rage.
Can you try the instructions here: https://docs.npmjs.com/getting-started/fixing-npm-permissions
The serialport
module installation does fail sometimes which is why Particle-CLI failed install.
Sorry for the friction! We are here to help
Thanks @kennethlimcp. So after looking at that helpful article, I saw it contains the same matrix of solutions I have already read and tried without success. Regardless, I optimistically followed "option 1", with the same results;
sudo npm install -g serialport
/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
> serialport@4.0.7 install /usr/local/lib/node_modules/serialport
> node-pre-gyp install --fallback-to-build
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
sh: node-pre-gyp: command not found
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.7.2/bin/node" "/usr/local/bin/npm" "install" "-g" "serialport"
npm ERR! node v7.7.2
npm ERR! npm v4.1.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! serialport@4.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the serialport@4.0.7 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.
Maybe this is also required: (sudo) npm install -g node-gyp
Thanks mate, so I ran that, didn't get any errors (but a tree response I can provide if you need), so then I ran;
sudo npm install -g serialport
and received the same goodness...
/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
> serialport@4.0.7 install /usr/local/lib/node_modules/serialport
> node-pre-gyp install --fallback-to-build
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
sh: node-pre-gyp: command not found
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.7.2/bin/node" "/usr/local/bin/npm" "install" "-g" "serialport"
npm ERR! node v7.7.2
npm ERR! npm v4.1.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! serialport@4.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the serialport@4.0.7 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.
What does npm list -g --depth=0
say?
Can you also try to cd
to your Desktop before running sudo npm install -g particle-cli
again?
This is what the terminal outputs, should I run a verbose switch or are there log files that will help?
/usr/local/bin/node-gyp -> /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js
/usr/local/lib
βββ¬ node-gyp@3.5.0
βββ¬ fstream@1.0.11
β βββ inherits@2.0.3
βββ¬ glob@7.1.1
β βββ fs.realpath@1.0.0
β βββ¬ inflight@1.0.6
β β βββ wrappy@1.0.2
β βββ once@1.4.0
β βββ path-is-absolute@1.0.1
βββ graceful-fs@4.1.11
βββ¬ minimatch@3.0.3
β βββ¬ brace-expansion@1.1.6
β βββ balanced-match@0.4.2
β βββ concat-map@0.0.1
βββ¬ mkdirp@0.5.1
β βββ minimist@0.0.8
βββ¬ nopt@3.0.6
β βββ abbrev@1.1.0
βββ¬ npmlog@4.0.2
β βββ¬ are-we-there-yet@1.1.2
β β βββ delegates@1.0.0
β β βββ¬ readable-stream@2.2.3
β β βββ buffer-shims@1.0.0
β β βββ core-util-is@1.0.2
β β βββ isarray@1.0.0
β β βββ process-nextick-args@1.0.7
β β βββ string_decoder@0.10.31
β β βββ util-deprecate@1.0.2
β βββ console-control-strings@1.1.0
β βββ¬ gauge@2.7.3
β β βββ aproba@1.1.1
β β βββ has-unicode@2.0.1
β β βββ object-assign@4.1.1
β β βββ signal-exit@3.0.2
β β βββ¬ string-width@1.0.2
β β β βββ code-point-at@1.1.0
β β β βββ¬ is-fullwidth-code-point@1.0.0
β β β βββ number-is-nan@1.0.1
β β βββ¬ strip-ansi@3.0.1
β β β βββ ansi-regex@2.1.1
β β βββ wide-align@1.1.0
β βββ set-blocking@2.0.0
βββ¬ osenv@0.1.4
β βββ os-homedir@1.0.2
β βββ os-tmpdir@1.0.2
βββ¬ request@2.81.0
β βββ aws-sign2@0.6.0
β βββ aws4@1.6.0
β βββ caseless@0.12.0
β βββ¬ combined-stream@1.0.5
β β βββ delayed-stream@1.0.0
β βββ extend@3.0.0
β βββ forever-agent@0.6.1
β βββ¬ form-data@2.1.2
β β βββ asynckit@0.4.0
β βββ¬ har-validator@4.2.1
β β βββ¬ ajv@4.11.5
β β β βββ co@4.6.0
β β β βββ¬ json-stable-stringify@1.0.1
β β β βββ jsonify@0.0.0
β β βββ har-schema@1.0.5
β βββ¬ hawk@3.1.3
β β βββ boom@2.10.1
β β βββ cryptiles@2.0.5
β β βββ hoek@2.16.3
β β βββ sntp@1.0.9
β βββ¬ http-signature@1.1.1
β β βββ assert-plus@0.2.0
β β βββ¬ jsprim@1.3.1
β β β βββ extsprintf@1.0.2
β β β βββ json-schema@0.2.3
β β β βββ verror@1.3.6
β β βββ¬ sshpk@1.11.0
β β βββ asn1@0.2.3
β β βββ assert-plus@1.0.0
β β βββ bcrypt-pbkdf@1.0.1
β β βββ¬ dashdash@1.14.1
β β β βββ assert-plus@1.0.0
β β βββ ecc-jsbn@0.1.1
β β βββ¬ getpass@0.1.6
β β β βββ assert-plus@1.0.0
β β βββ jodid25519@1.0.2
β β βββ jsbn@0.1.1
β β βββ tweetnacl@0.14.5
β βββ is-typedarray@1.0.0
β βββ isstream@0.1.2
β βββ json-stringify-safe@5.0.1
β βββ¬ mime-types@2.1.14
β β βββ mime-db@1.26.0
β βββ oauth-sign@0.8.2
β βββ performance-now@0.2.0
β βββ qs@6.4.0
β βββ safe-buffer@5.0.1
β βββ stringstream@0.0.5
β βββ¬ tough-cookie@2.3.2
β β βββ punycode@1.4.1
β βββ tunnel-agent@0.6.0
β βββ uuid@3.0.1
βββ rimraf@2.6.1
βββ semver@5.3.0
βββ¬ tar@2.2.1
β βββ block-stream@0.0.9
βββ¬ which@1.2.12
βββ isexe@1.1.2
Sorry, your original question
npm node-gyp --version
4.1.2