离子生成android,错误:产卵EACCES

如果我按照这个步骤来创build一个新的应用程序:

Rubens-MacBook-Pro:~ rlopez$ npm install -g cordova ionic Rubens-MacBook-Pro:~ rlopez$ ionic start myApp tabs Rubens-MacBook-Pro:~ rlopez$ cd myApp Rubens-MacBook-Pro:myApp rlopez$ ionic platform add android@6.2.2 //6.1.x has a bug Rubens-MacBook-Pro:myApp rlopez$ ionic build android 

我得到这个输出:

 > ionic-hello-world@ ionic:build /Users/rlopez/Proyectos/sfp-concursaPy > ionic-app-scripts build [15:13:28] ionic-app-scripts 1.1.4 [15:13:28] build dev started ... [15:13:28] clean started ... [15:13:28] clean finished in 3 ms [15:13:28] copy started ... [15:13:28] transpile started ... [15:13:31] transpile finished in 2.96 s [15:13:31] preprocess started ... [15:13:31] preprocess finished in less than 1 ms [15:13:31] webpack started ... [15:13:31] copy finished in 3.17 s [15:13:41] webpack finished in 9.26 s [15:13:41] sass started ... [15:13:41] sass finished in 897 ms [15:13:41] postprocess started ... [15:13:41] postprocess finished in 1 ms [15:13:41] lint started ... [15:13:41] build dev finished in 13.15 s [15:13:43] lint finished in 2.04 s ANDROID_HOME=/Users/rlopez/Library/Android/sdk JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home Error: spawn EACCES 

运行离子信息给出以下内容:

 Your system information: Cordova CLI: 6.5.0 Ionic Framework Version: 3.1.1 Ionic CLI Version: 2.2.3 Ionic App Lib Version: 2.2.1 Ionic App Scripts Version: 1.3.6 ios-deploy version: 1.8.5 ios-sim version: 5.0.13 OS: OS X El Capitan Node Version: v6.10.1 Xcode version: Xcode 7.3.1 Build version 7D1014 

我什么错误? 这是离子的错误吗?

[编辑]

运行ionic build android --verbose提供以下输出:

 Running command: "/Applications/Android Studio 2.4 Preview.app/Contents/gradle/gradle-3.4.1/bin/gradle" -p /Users/rlopez/myApp/platforms/android wrapper -b /Users/rlopez/myApp/platforms/android/wrapper.gradle Error: spawn EACCES at exports._errnoException (util.js:1018:11) at ChildProcess.spawn (internal/child_process.js:319:11) at Object.exports.spawn (child_process.js:378:9) at exports.spawn(/Users/rlopez/myApp/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:134:31) at GradleBuilder.runGradleWrapper(/Users/rlopez/myApp/platforms/android/cordova/lib/builders/GradleBuilder.js:78:14) at /Users/rlopez/myApp/platforms/android/cordova/lib/builders/GradleBuilder.js:178:21 at _fulfilled (/Users/rlopez/myApp/platforms/android/cordova/node_modules/q/q.js:854:54) at self.promiseDispatch.done (/Users/rlopez/myApp/platforms/android/cordova/node_modules/q/q.js:883:30) at Promise.promise.promiseDispatch (/Users/rlopez/myApp/platforms/android/cordova/node_modules/q/q.js:816:13) at /Users/rlopez/myApp/platforms/android/cordova/node_modules/q/q.js:570:49 

Solutions Collecting From Web of "离子生成android,错误:产卵EACCES"

今天得到了同样的错误。 感谢上面的评论,这里是我如何解决它。

 $ cordova build android --verbose 

它显示我在哪里得到“权限被拒绝”的错误…在我的情况是这样的:

 Running command: /usr/libexec/java_home Command finished with error code 0: /usr/libexec/java_home ANDROID_HOME=/Users/mj/phonegap/adt-bundle-mac-x86_64-20140321/sdk JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home Running command: "/Applications/Android Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle" -p /Users/mj/EduceMobile/app/platforms/android wrapper -b /Users/mj/EduceMobile/app/platfo rms/android/wrapper.gradle 

要解决,跑了:

 $ sudo chmod 755 /Applications/Android\ Studio.app/Contents/grad le/gradle-2.2.1/bin/gradle 

…和

 ... ... :cdvBuildDebug BUILD SUCCESSFUL Total time: 2 mins 44.195 secs 

希望能帮助到你。

对于将Android Studio更新到版本3.x后出现类似错误的用户,可以运行以下命令来修复它:

sudo chmod 755 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin/gradle

希望它有帮助!

刚刚遇到同样的问题,我不认为这与sudo有什么关系 – 该命令只是缺less执行权限

 chmod +x hooks/after_prepare/010_add_platform_class.js 
 sudo chmod 755 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin/gradle 

运行ionic build android --verbose提供以下输出:

 /Applications/Android Studio 2.4 Preview.app/Contents/gradle/gradle-3.4.1/bin/gradle -p /Users/rlopez/myApp/platforms/android wrapper -b /Users/rlopez/myApp/platforms/android/wrapper.gradle Error: spawn EACCES at exports._errnoException (util.js:1018:11) at ChildProcess.spawn (internal/child_process.js:319:11) at Object.exports.spawn (child_process.js:378:9) at exports.spawn(/Users/rlopez/myApp/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:134:31) at GradleBuilder.runGradleWrapper(/Users/rlopez/myApp/platforms/android/cordova/lib/builders/GradleBuilder.js:78:14) at /Users/rlopez/myApp/platforms/android/cordova/lib/builders/GradleBuilder.js:178:21 at _fulfilled (/Users/rlopez/myApp/platforms/android/cordova/node_modules/q/q.js:854:54) at self.promiseDispatch.done (/Users/rlopez/myApp/platforms/android/cordova/node_modules/q/q.js:883:30) at Promise.promise.promiseDispatch (/Users/rlopez/myApp/platforms/android/cordova/node_modules/q/q.js:816:13) at /Users/rlopez/myApp/platforms/android/cordova/node_modules/q/q.js:570:49 

更改/Applications/Android Studio 2.4 Preview.app/Contents/gradle/gradle-3.4.1/bin/gradle的权限/Applications/Android Studio 2.4 Preview.app/Contents/gradle/gradle-3.4.1/bin/gradle解决了这个问题。

以上的解决scheme并不适合我。 我解决了这个命令的错误:

 chmod 755 platforms/android/gradlew 

我遇到了同样的问题,我通过在应用程序文件夹中运行以下命令来解决它:

 ionic hooks add 

仅用于OSX —从查找器转到应用程序文件夹,并通过删除之间的空格重命名Android Studio应用程序包名称。

之前: Android Studio之后:AndroidStudio

默认情况下没有权限问题,只是空间是问题。

干杯!

我能够通过在terminal中运行以下命令来修复

 sudo chmod 755 "/Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle" 

在这里输入图像说明

运行后,我能够成功运行此命令

 ionic cordova build android --release 

更改的权限

/应用程序/ Android Studio应用程序path/内容/ gradle / gradle- * /斌/ gradle这个

您必须修复您的系统帐户可执行的“gradle”:

$ sudo chmod 755 /Applications/Android\ Studio.app/Contents/grad le/gradle-<VERSION>/bin/gradle

我有同样的麻烦,但现在它为我工作。