简体   繁体   English

如何通过CLI将适用于iOS的插件添加到Phonegap中?

[英]How to add plugin for iOS into Phonegap via CLI?

I'm trying to build my app using the Phonegap CLI . 我正在尝试使用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 $ sudo phonegap插件添加cordova-plugin-globalization

Error: Failed to fetch plugin git+ https://github.com/apache/cordova-plugin-globalization.git via registry. 错误:无法通过注册表获取插件git + https://github.com/apache/cordova-plugin-globalization.git

Probably this is either a connection problem, or plugin spec is incorrect. 可能是连接问题,或者插件规格不正确。

Check your connection and plugin name/version/URL. 检查您的连接和插件名称/版本/ URL。

Error: npm: Command failed with exit code 1 Error output: 错误:npm:命令失败,退出代码为1错误输出:

npm ERR! npm ERR! code 1 代码1

npm ERR! 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 命令失败:/ usr / bin / git clone -q https://github.com/apache/cordova-plugin-globalization.git /Users/apple/.npm/_cacache/tmp/git-clone-4dc164cf

npm ERR! npm ERR! /Users/apple/.npm/_cacache/tmp/git-clone-4dc164cf/.git: Permission denied /Users/apple/.npm/_cacache/tmp/git-clone-4dc164cf/.git:权限被拒绝

npm ERR! npm ERR!

npm ERR! npm ERR! A complete log of this run can be found in: 可以在以下位置找到此运行的完整日志:

npm ERR! npm ERR!
/Users/apple/.npm/_logs/2018-03-02T11_53_27_023Z-debug.log /用户/苹果/.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 npm@5.6.0
3 info using node@v8.9.4
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. 如果浏览到/ Users / apple / ,则看不到.npm文件夹。 Is this hidden? 这是隐藏的吗?

Eugh, I'm kicking myself!!!! 埃格,我在踢自己!

  • My project folder was called "chambres new test". 我的项目文件夹称为“ chambres新测试”。 It didn't seem to like the spaces. 它似乎不喜欢这些空间。 I've re-created it as just "chambres", and it adds plugins now 我已经将其重新创建为“ chambres”,并且现在添加了插件
  • I was trying to add plugins like so: 我试图像这样添加插件:

sudo phonegap plugin add https://github.com/apache/cordova-plugin-device.git sudo phonegap插件添加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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM