简体   繁体   English

在Ubuntu中添加android平台时出现Phonegap错误

[英]Phonegap error in adding android platform in ubuntu

While i try to add an android platform in my Phonegap project i get this error 当我尝试在Phonegap项目中添加android平台时出现此错误

Failed to install 'cordova-plugin-whitelist':Error: <project_path>/platforms/android/cordova/version: Command failed with exit code EACCES
    at ChildProcess.whenDone (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:95:17)
    at Process.ChildProcess._handle.onexit (child_process.js:818:12)

And i try do some of this link solutions like give permission to build and remove the android platform and add it again but every time i get the same error 我尝试做一些这样的链接解决方案,例如授予建立和删除android平台的权限,然后再次添加它,但是每次我遇到相同的错误时

What is the potential solution ? 潜在的解决方案是什么?

As per documentation there is no need to run cordova platform add android as root . 根据文档 ,无需运行cordova platform add android作为root cordova platform add android Check the example: 检查示例:

$ cordova create hello com.example.hello HelloWorld
$ cd hello
$ cordova platform add android
$ cordova build

If you still face any issue check that executable scripts or programs are allowed to be executed. 如果仍然遇到任何问题,请检查是否允许执行可执行脚本或程序。

In your case I'd guess that cordova tries to run 以您的情况,我想cordova试着跑

<project_path>/platforms/android/cordova/version

what is probably not allowed to be executed. 可能不允许执行的操作。 So call 所以打电话

sudo chmod ugo+x <project_path>/platforms/android/cordova/version

to make version executable. 使version可执行。

ps : updated my answer above. ps更新了我上面的答案。 Some days ago I tested for another post what happens, if I added the platform as root . 几天前,如果我将平台添加为root ,我还测试了另一篇文章会发生什么。 Though it was another issue there I saw that it is not required to run cordova platform add android as root . 尽管那是另一个问题,但我看到它不是必须运行cordova platform add android作为root

I think it's only the basic installation of Cordova that requires root . 我认为这只是需要root的Cordova的基本安装。 Everything else should be set up and executed as a normal user. 其他所有内容均应以普通用户身份设置和执行。

我不知道问题出在哪里,但是我在linux / ubuntu上工作,我尝试在家里创建一个应用程序,而这个问题消失了,我想这取决于权限或安装磁盘!

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

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