pcj pcj - 1 month ago 19
Node.js Question

Unable to install ionic on MacBook Pro using npm install -g cordova ionic?

I am logged in as admin user. I have installed latest node.js from https://nodejs.org/en/ using node-v6.9.1.pkg file. I have installed it for all users.

When I try to execute following command as given on ionic side (https://ionicframework.com/getting-started/):

npm install -g cordova ionic


Also I tried above command using
sudo
but I am getting error like :

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code MODULE_NOT_FOUND

npm ERR! Cannot find module 'github-url-from-git'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>

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


I am new to Mac, what might be the cause ?

Answer

Seems that is a nodejs problem. Follow these steps:

1) rm -rf /usr/local/lib/node_modules/npm

2) reinstall nodejs