6

I have installed npm to setup Ionic & Cordova - and I have used sudo for this?

My question is when I run the following command without sudo I get an error:

cordova emulate ios

The error is an

EACCES, permission denied ..... /ios.json

Am I right that if I cannot use this 'basic' cordova command without running sudo my installation has been screwed up somehow?

Zabs
  • 13,852
  • 45
  • 173
  • 297
  • 1
    You should not use sudo to install global npm packages. See http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo – lxe May 13 '15 at 15:51

1 Answers1

12

I did the following on the terminal to allow me to run the commands without using sudo (this might help someone)

sudo chown -R $(whoami) ~/Documents/mobileapps

This meant the cordova emulate ios command now runs! finally!

Zabs
  • 13,852
  • 45
  • 173
  • 297
  • 3
    Yes, it helped me! I had an additional issue however -- cordova commands such as $ cordova plugins or even cordova help were failing with the same error message. Fixed with the same trick: sudo chown -R $(whoami) /Users/USERNAME/.config/configstore/update-notifier-cordova.json I suspect however that this means something more profound went wrong with my last update. – brianfit Nov 29 '15 at 06:46