How to add plugin for iOS into Phonegap via CLI?

89 Views Asked by At

I'm trying to build my app using the Phonegap CLI. I've got the project created, and then when I try and add the plugins I get:

$ sudo phonegap plugin add cordova-plugin-globalization

Error: Failed to fetch plugin git+https://github.com/apache/cordova-plugin-globalization.git via registry.

Probably this is either a connection problem, or plugin spec is incorrect.

Check your connection and plugin name/version/URL.

Error: npm: Command failed with exit code 1 Error output:

npm ERR! code 1

npm ERR! Command failed: /usr/bin/git clone -q https://github.com/apache/cordova-plugin-globalization.git /Users/apple/.npm/_cacache/tmp/git-clone-4dc164cf

npm ERR! /Users/apple/.npm/_cacache/tmp/git-clone-4dc164cf/.git: Permission denied

npm ERR!

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

npm ERR!
/Users/apple/.npm/_logs/2018-03-02T11_53_27_023Z-debug.log

The full log has this in it:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'git+https://github.com/apache/cordova-plugin-globalization.git',
1 verbose cli   '--production',
1 verbose cli   '--save' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 85b442bcb6c2c486
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for git+https://github.com/apache/cordova-plugin-globalization.git Command failed: $
7 silly fetchPackageMetaData /Users/apple/.npm/_cacache/tmp/git-clone-4dc164cf/.git: Permission denied
8 verbose stack Error: Command failed: /usr/bin/git clone -q https://github.com/apache/cordova-plugin-globalization.gi$
8 verbose stack /Users/apple/.npm/_cacache/tmp/git-clone-4dc164cf/.git: Permission denied
8 verbose stack
8 verbose stack     at ChildProcess.exithandler (child_process.js:275:12)
8 verbose stack     at emitTwo (events.js:126:13)
8 verbose stack     at ChildProcess.emit (events.js:214:7)
8 verbose stack     at maybeClose (internal/child_process.js:925:16)

8 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

9 verbose cwd /Users/apple/Desktop/chambes phonegap app/Chamresdhotesapp

10 verbose Darwin 17.4.0

11 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "git+https://github.com/apache/cordova-plugin-glo$
12 verbose node v8.9.4
13 verbose npm  v5.6.0
14 error code 1
15 error Command failed: /usr/bin/git clone -q https://github.com/apache/cordova-plugin-globalization.git /Users/apple$
15 error /Users/apple/.npm/_cacache/tmp/git-clone-4dc164cf/.git: Permission denied
16 verbose exit [ 1, true ]

If I browse to /Users/apple/, I don't see a .npm folder. Is this hidden?

1

There are 1 best solutions below

0
Andrew Newby On

Eugh, I'm kicking myself!!!!

  • My project folder was called "chambres new test". It didn't seem to like the spaces. I've re-created it as just "chambres", and it adds plugins now
  • I was trying to add plugins like so:

sudo phonegap plugin add https://github.com/apache/cordova-plugin-device.git

For some reason it didn't like that. It did however work with:

sudo phonegap plugin add cordova-plugin-device