Search code examples
cordovacordova-pluginsios9.2

Why won't the device plugin install in a Cordova 6.0 project?


Why won't the device plugin install on a Cordova 6.0 iOS project? Here is the text from terminal app.

Justins-Air:hipmvi itiMobile$ cordova plugin add cordova-plugin-device Fetching plugin "cordova-plugin-device@~1.1.1" via npm Error: Failed to fetch plugin cordova-plugin-device@~1.1.1 via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Error: EACCES, mkdir '/Users/itiMobile/.npm/cordova-plugin-device


Solution

  • It looks like it was a permissions issue. I tried solving it by using sudo before the commands, but got errors. Then I rebooted the mac and tried again. The sudo version of the command then allowed me to add the plugin.

    However, I could not open xCode at that point. I got around that by selecting the folder in finder and choosing get info from the file menu. I scrolled to the bottom, clicked on the lock icon, and granted read write to everyone. After that, I chose apply to all items in folder from the settings drop down list at the bottom of the get info window. I was then allowed to open the project in xCode.

    Thank you @alexchance for pointing me in the right direction.