I'm new to ionic...facing problem while installing ionic in MacBook

Amalanathans-MacBook-Pro:~ angelamal$ npm install -g ionic

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/ionic

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules

npm ERR! path /usr/local/lib/node_modules/ionic

npm ERR! code EACCES

npm ERR! errno -13

npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules/ionic’

npm ERR! { [Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules/ionic’]

npm ERR! stack:

npm ERR! ‘Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules/ionic’’,

npm ERR! errno: -13,

npm ERR! code: ‘EACCES’,

npm ERR! syscall: ‘access’,

npm ERR! path: ‘/usr/local/lib/node_modules/ionic’ }

npm ERR!

npm ERR! The operation was rejected by your operating system.

npm ERR! It is likely you do not have the permissions to access this file as the current user

npm ERR!

npm ERR! If you believe this might be a permissions issue, please double-check the

npm ERR! permissions of the file and its containing directories, or try running

npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:

npm ERR! /Users/angelamal/.npm/_logs/2019-01-29T11_56_19_678Z-debug.log

Amalanathans-MacBook-Pro:~ angelamal$ sudo npm install -g ionic

Password:

/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic

  • ionic@4.9.0

updated 1 package in 12.929s

hi, try reading thru this thread

I executed this command first

sudo chown -R $USER /usr/local/

and then this one
npm install -g @ionic/cli cordova-res

and is all good now

A much better strategy is to install and use nvm.