Sudo npm install -g cordova ionic doesn`t work on my mac


#1

I installed node & npm package from https://nodejs.org/en/ (node v.4.4.0, npm v.2.14.20, also tried latest npm version).
After that I tried to install ionic: sudo npm install -g cordova ionic, but it failed with output:

npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic

node-sass@3.4.2 install /usr/local/lib/node_modules/ionic/node_modules/node-sass
node scripts/install.js

sh: node: command not found
npm ERR! Darwin 15.3.0
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” “-g” “cordova” "ionic"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! node-sass@3.4.2 install: node scripts/install.js
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the node-sass@3.4.2 install script ‘node scripts/install.js’.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR!
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.

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

Any ideas how to fix this trouble?
Thanks in advance!


#2

I recently updated my whole brew system, updated node, and updated npm.

I had the same problem. using the:

‘sudo npm install -g cordova ionic’

I was able to install cordova with ‘sudo npm install -g cordova’

then install ionic with ‘sudo npm install -g ionic’

hope that helps