[SOLVED] 1.5.2: Cordova [Error: spawn EACCES]


#1

When building my Meteor Cordova this error occurs. It only happens for the Cordova app.

While running Cordova app for platform Android with options --device:
   Error: Command failed:                     
   /Users/fullhdpixel/Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/run
   --device
   { [Error: spawn EACCES] code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }
   'Error: spawn EACCES\n    at exports._errnoException (util.js:907:11)\n

Full log: https://pastebin.com/raw/4xbxJSC5

If you need a reproduction let me know, but I think this is something you can help with without a reproduction. Here is the cordova-plugin list

cordova-custom-config@4.0.2
cordova-plugin-crosswalk-webview@2.3.0
cordova-plugin-device@1.1.6
cordova-plugin-file@4.3.3
cordova-plugin-geolocation@2.4.3
cordova-plugin-inappbrowser@1.7.1
cordova-plugin-meteor-webapp@1.4.2
cordova-plugin-splashscreen@4.0.3
cordova-plugin-statusbar@2.2.3
cordova-plugin-tts@0.2.3
cordova-plugin-wkwebview-engine@1.1.3
cordova-plugin-x-socialsharing@5.2.0
cordova-universal-links-plugin@1.2.1
cordova-plugin-console@1.0.7
cordova-plugin-flurryanalytics@1.4.3


#2

Still same issue also on 1.6. Only 1.5.1 didnt have issues:

=> Errors executing Cordova commands:         
                                              
   While running Cordova app for platform Android with options --device:
   Error: Command failed:                     
   Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/run
   --device
   { Error: spawn EACCES
   at _errnoException (util.js:1026:11)
   at ChildProcess.spawn (internal/child_process.js:325:11)
   at Object.exports.spawn (child_process.js:493:9)
   at exports.spawn
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:134:31)
   at GradleBuilder.runGradleWrapper
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/lib/builders/GradleBuilder.js:78:14)
   at
   Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/lib/builders/GradleBuilder.js:178:21
   at _fulfilled
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:854:54)
   at self.promiseDispatch.done
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:883:30)
   at Promise.promise.promiseDispatch
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:816:13)
   at
   Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:570:49
   code: 'EACCES', errno: 'EACCES', syscall: 'spawn' } 'Error: spawn
   EACCES\n    at _errnoException (util.js:1026:11)\n    at ChildProcess.spawn
   (internal/child_process.js:325:11)\n    at Object.exports.spawn
   (child_process.js:493:9)\n    at exports.spawn
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:134:31)\n
   at GradleBuilder.runGradleWrapper
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/lib/builders/GradleBuilder.js:78:14)\n
   at
   Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/lib/builders/GradleBuilder.js:178:21\n
   at _fulfilled
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:854:54)\n
   at self.promiseDispatch.done
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:883:30)\n
   at Promise.promise.promiseDispatch
   (Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:816:13)\n
   at
   Projects/MyRoutes/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:570:49'
   at ChildProcess.exitCallback (/tools/utils/processes.js:151:23)
   at emitTwo (events.js:125:13)
   at ChildProcess.emit (events.js:213:7)
   at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
                                              
.meteor/packages/coffeescript/.1.0.17.cmkm33++os+web.browser+web.cordova/plugin.compileCoffeescript.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:116
      throw error;
      ^
ExitWithCode:1

#3

Finally fixed:

  1. Change permission on gradle file.
chmod 755 /Applications/Android Studio 2.4 Preview.app/Contents/gradle/gradle-3.4.1/bin/gradle
  1. Make sure gradle file is good
/Users/<username>/.gradle/wrapper/dists/gradle-3.3-all/

#4

So wondering? Why is this a fix? Why did the permissions on the gradle file need to be changed? What happened from the previous implementation to change the requirements of the gradle file?

What do you mean by make sure the gradle file is good? And why is it a different gradle file to the one which permissions are modified?

Trying to understand the error, and not just make it go away.


#5

Tbh I dont know what caused the permission changes. It was a lot of trial and error that fixed it in the end. Now I’m not longer fan of Cordova. Just gonna look into React Native now.


#6

ah okay thanks. I think it must have something to do with using Sudo earlier for installing something. Best guess anyway.

chmod 755 on that gradle file worked for me also in the end.


#7

Thanks @fullhdpixel, I’m on Meteor 1.6.0.1 and this resolved the issue for me as well.

/Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle

chmod 755 on gradle