Cordova android构建失败[错误:生成EACCES]

时间:2021-10-15 22:59:15

I am just getting started with with Cordova ( PhoneGap ) and trying to build my first project with it, however I am running into a problem with my compilation step- when I try to build ( in tracking down the problem I broke down the build step into prepare and compile and the former works fine as far as I know ) I see this:

我刚刚开始和科尔多瓦(PhoneGap)和试图建立我的第一个项目,但是我遇到一个问题,我的编译步骤——当我试图构建(在跟踪我破裂的问题构建进入准备和编译和前没问题就我所知)我看到这个:

~/Projects/MyProject$ cordova compile android
Compiling app on platform "android" via command "/media/glenatron/local disk/Projects/Cordova/MyProject/platforms/android/cordova/build" 
{ [Error: spawn EACCES] code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }

Now from what I can tell this is a permissions problem, but having no Node or Cordova experience yet I am at a loss as to how to troubleshoot it. It looks as though it is trying to spawn another process - maybe the Android SDK? - and it is failing.

现在我可以看出这是一个权限问题,但是没有节点或Cordova的经验,但是对于如何排除它,我还是不知所措。它看起来好像是在试图衍生另一个过程——也许是Android SDK?-而且失败了。

Is there a way I can ask Node or Cordova to give me more information on what is going on or is there a log file somewhere that will help me to track down what the problem is?

有什么方法可以让我问Node或者Cordova给我更多关于正在发生的事情的信息或者有一个日志文件可以帮助我找到问题是什么?

Edit: I realised cordova has a --verbose switch and when I activated it I get the above output with an additional couple of lines...

编辑:我意识到cordova有一个详细的开关,当我激活它的时候,我得到了上面的输出和另外几行…

Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

Unfortunately, they don't seem to actually give much more information, like which process it can't start.

不幸的是,他们似乎并没有给出更多的信息,比如哪一个过程是无法启动的。

5 个解决方案

#1


23  

It's a permission issue, just execute

这是一个权限问题,只是执行。

chmod 777 "/media/glenatron/local disk/Projects/Cordova/MyProject/platforms/android/cordova/build"

chmod 777”/媒体/ glenatron /本地磁盘/项目/科尔多瓦/ MyProject科尔多瓦/平台/ android / /构建”

that should fix the problem

这应该能解决问题。

#2


30  

For me, this has fixed it:

对我来说,这是固定的:

chmod 777 /Applications/Android\ Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle

chmod 777 /应用程序/ Android \ Studio.app /内容/ gradle / gradle-2.2.1 / bin / gradle

#3


7  

Using verbose like Solidak suggested works.

使用像Solidak这样的冗长的建议。

cordova build --release --verbose android

cordova构建——发布——冗长的android。

The last command was to access /platforms/android/gradlew so i chmod +x that file and it worked.

最后一个命令是访问/平台/android/gradlew,所以我chmod +x文件,它成功了。

#4


4  

Its different for every one, I guess. Running --verbose would give you the file that Cordova needs access to. From there you can chmod 777 <file>. The command you should run to figure out the inaccessible file looks like this: cordova build --release --verbose android

我想这对每个人来说都是不同的。运行——verbose将提供Cordova需要访问的文件。从那里你可以查到777的档案,>。您应该运行的命令来查找无法访问的文件:cordova构建——发布——verbose android。

#5


0  

I was facing the same issue. In my case, I had put the sample cordova project on a different ext3 partition than home folder. Since the partition was not NTFS, permissions shouldn't have been a problem. But when I tried all suggested methods (changing permissions, making everything executable), none of them worked. This problem went away as soon as I created the sample cordova folder in my home partition.

我也面临着同样的问题。在我的例子中,我将cordova示例项目放在不同的ext3分区上,而不是home文件夹。由于分区不是NTFS,所以权限不应该是问题。但是,当我尝试所有建议的方法(修改权限,使所有的东西都可执行)时,它们都不起作用。当我在我的家庭分区中创建了sample cordova文件夹时,这个问题就消失了。

#1


23  

It's a permission issue, just execute

这是一个权限问题,只是执行。

chmod 777 "/media/glenatron/local disk/Projects/Cordova/MyProject/platforms/android/cordova/build"

chmod 777”/媒体/ glenatron /本地磁盘/项目/科尔多瓦/ MyProject科尔多瓦/平台/ android / /构建”

that should fix the problem

这应该能解决问题。

#2


30  

For me, this has fixed it:

对我来说,这是固定的:

chmod 777 /Applications/Android\ Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle

chmod 777 /应用程序/ Android \ Studio.app /内容/ gradle / gradle-2.2.1 / bin / gradle

#3


7  

Using verbose like Solidak suggested works.

使用像Solidak这样的冗长的建议。

cordova build --release --verbose android

cordova构建——发布——冗长的android。

The last command was to access /platforms/android/gradlew so i chmod +x that file and it worked.

最后一个命令是访问/平台/android/gradlew,所以我chmod +x文件,它成功了。

#4


4  

Its different for every one, I guess. Running --verbose would give you the file that Cordova needs access to. From there you can chmod 777 <file>. The command you should run to figure out the inaccessible file looks like this: cordova build --release --verbose android

我想这对每个人来说都是不同的。运行——verbose将提供Cordova需要访问的文件。从那里你可以查到777的档案,>。您应该运行的命令来查找无法访问的文件:cordova构建——发布——verbose android。

#5


0  

I was facing the same issue. In my case, I had put the sample cordova project on a different ext3 partition than home folder. Since the partition was not NTFS, permissions shouldn't have been a problem. But when I tried all suggested methods (changing permissions, making everything executable), none of them worked. This problem went away as soon as I created the sample cordova folder in my home partition.

我也面临着同样的问题。在我的例子中,我将cordova示例项目放在不同的ext3分区上,而不是home文件夹。由于分区不是NTFS,所以权限不应该是问题。但是,当我尝试所有建议的方法(修改权限,使所有的东西都可执行)时,它们都不起作用。当我在我的家庭分区中创建了sample cordova文件夹时,这个问题就消失了。