Ionic build android, Error: spawn EACCES

后端 未结 15 985
孤城傲影
孤城傲影 2021-01-31 02:44

If I follow this steps to create a new app:

Rubens-MacBook-Pro:~ rlopez$ npm install -g cordova ionic
Rubens-MacBook-Pro:~ rlopez$ ionic start myApp tabs
Rubens-         


        
相关标签:
15条回答
  • 2021-01-31 03:04

    Got the same error today. Thanks to the comments above, here is how I fixed it.

    Ran:

    cordova build android --verbose
    

    and it showed me where it got the "Permission Denied" error... In my case it was:

    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
    

    To fix, ran:

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

    ...and

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

    Hope it helps.

    0 讨论(0)
  • 2021-01-31 03:07

    My problem wasn't permissions... I couldn't quite find the origin of the problem but I did a workaround. this error was happening when I was trying to add a plugin which wasn't updated to the new files/folder system.

    cordova platform android -v
    

    it returned -> 8.0.0

    What I did was:

    cordova platform rm android
    cordova platform add android@6.4.0
    

    and then:

    cordova plugin add <plugin>
    

    This way the plugin installation showed no errors.. but keep in mind that after the cordova plugin add command, the android platform version automatically updated to 8.0.0 again... so I had to repeat the process in order to add another plugin with the same issue.

    After repeating this process 2 times I finally got the project to run with the 2 plugins installed

    0 讨论(0)
  • 2021-01-31 03:08
    sudo chmod 755 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin/gradle
    
    0 讨论(0)
  • 2021-01-31 03:10

    Above solutions didn't work for me. I solved error with this command:

    chmod 755 platforms/android/gradlew
    
    0 讨论(0)
  • 2021-01-31 03:10

    You have to fix the 'gradle' to be executable by your system account:

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

    I had same trouble but now it's working for me.

    0 讨论(0)
  • 2021-01-31 03:11

    Changing the permissions of

    /Applications/Android Studio App Path /Contents/gradle/gradle-..*/bin/gradle

    0 讨论(0)
提交回复
热议问题