简体   繁体   中英

Phonegap error in adding android platform in ubuntu

While i try to add an android platform in my Phonegap project i get this error

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

What is the potential solution ?

As per documentation there is no need to run cordova platform add android as root . 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

<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.

ps : updated my answer above. Some days ago I tested for another post what happens, if I added the platform as root . Though it was another issue there I saw that it is not required to run cordova platform add android as root .

I think it's only the basic installation of Cordova that requires root . Everything else should be set up and executed as a normal user.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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