How to fix this Error: spawn EACCES


#1
    imac:myApp isathish$ sudo ionic emulate ios
running cordova emulate ios
Running command: /Users/isathish/myApp/hooks/after_prepare/010_add_platform_class.js /Users/isathish/myApp
Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1162:11)
    at Object.exports.spawn (child_process.js:995:9)
    at Object.exports.spawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:100:31)
    at runScriptViaChildProcessSpawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:188:23)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:131:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:114:20
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
running cordova emulate ios
Running command: /Users/isathish/myApp/hooks/after_prepare/010_add_platform_class.js /Users/isathish/myApp
Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1162:11)
    at Object.exports.spawn (child_process.js:995:9)
    at Object.exports.spawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:100:31)
    at runScriptViaChildProcessSpawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:188:23)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:131:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:114:20
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)

Error: spawn EACCES [ERROR] An error occurred while running cordova build ios (exit code 1) with jscrambler.js
Error: spawn EACCES - what is this?
Ionic Framwork error when trying to add ios platform project
#2

no permissions to run that command?
use:
sudo …

or like you use sudo control your permissions


#3

sudo chmod -R a+rwx /appfolder


#4

did you try

ionic hooks add

#5

module.js:338
throw err;
^
Error: Cannot find module 'child-process-close’
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at /usr/local/lib/node_modules/npm/lib/npm.js:15:1
at Object. (/usr/local/lib/node_modules/npm/lib/npm.js:469:3)
at Module._compile (module.js:460:26)
at Object.Module._extensions…js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)


#6

This can happen if you ran part of the install with sudo (i.e. npm) which you have to do on OS X. You need to do sudo chown -R username * to change some of the files ownership from root to yourself.


#7

Just encountered the same issue, and I don’t think it has anything to do with sudo - that command is simply missing the execute permission

chmod +x hooks/after_prepare/010_add_platform_class.js

#8

Now its working thanks.


#9

then after should i execute all the the action in root ?


#10

than i was done this sudo chown -R username .config/


#11

I’m not using sudo at all and everything works fine for me after fixing the execute permission with chmod.


Adding platform and build
#12

This is the correct fix, I think however the ionic build should set this perm correctly on project setup.


#13

Indeed, looks like it’s this issue that should be fixed in the next release: ionic-cli #375


#14

nice fix! ^^ that works!


#15

Yep, that’s the fix.


#16

Hi Kevin Yang, Spurlex (I’m testing the Android App, where i got the below error…)
– I tried chmod -R 777 * but not fixed the issue
– Also tried “ionic hooks add” command but shown the error on terminal like
"ravis-MacBook-Pro:~ monocept$ ionic hooks add
-bash: ionic: command not found"

======================

i'm using APPIUM 1.4.8 and still the error like below when running the script with ANDROID app with MAC OS X(10.11 version) please check the brief and detailed error and help me out.

how to use the ionic hooks add command , when i ran the command in terminal saying ionic command not found......
============ Brief Error ======
31merrore[39m: Unhandled error: Error: connect ECONNREFUSED
    at exports._errnoException (util.js:746:11)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19) context: [POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk","appPackage":"com.weather.Weather","appActivity":"com.weather.Weather.app.]
e[
====================Detailed Error Below=============
[TestNG] Running:
  /private/var/folders/6y/3w4t1jld3997y9q_6cvwswqr0000gn/T/testng-eclipse-363334535/testng-customsuite.xml

Stopping the ADB server
ADB Server is stopped
===================================
Stopping the appium server
Appium server is stopped
Starting the appium server
Appium server is started and running
e[36minfoe[39m: Welcome to Appium v1.4.8 (REV c8179bd8352d3c62d98fa58b324491230df9342a)
e[36minfoe[39m: Appium REST http interface listener started on 127.0.0.1:4723
e[36minfoe[39m: [debug] Non-default server args: {"address":"127.0.0.1","noReset":true}
e[36minfoe[39m: Console LogLevel: debug
e[36minfoe[39m: e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{"desiredCapabilities":{"app":"/Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk","appPackage":"com.weather.Weather","appActivity":"com.weather.Weather.app.SplashScreenActivity","appium-version":"1.0","platformVersion":"5.0.1 // 4.2.2   5.1.1    5.0.1","platformName":"Android","deviceName":"Samsung"}}e[39m
e[36minfoe[39m: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)
e[36minfoe[39m: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : appium-version
e[36minfoe[39m: [debug] Using local app from desired caps: /Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk
e[36minfoe[39m: [debug] Creating new appium session fb0d13f8-0067-4fe0-8c36-af18228de11f
e[36minfoe[39m: Starting android appium
e[36minfoe[39m: [debug] Getting Java version
e[36minfoe[39m: Java version is: 1.8.0_60
e[36minfoe[39m: [debug] Checking whether adb is present
e[36minfoe[39m: [debug] Using adb from /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb
e[36minfoe[39m: [debug] Using fast reset? false
e[36minfoe[39m: [debug] Preparing device for session
e[36minfoe[39m: [debug] Checking whether app is actually present
e[36minfoe[39m: Retrieving device
e[36minfoe[39m: [debug] Trying to find a connected android device
e[36minfoe[39m: [debug] Getting connected devices...
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb devices
e[36minfoe[39m: [debug] 1 device(s) connected
e[36minfoe[39m: Found device 03157df33d91c039
e[36minfoe[39m: [debug] Setting device id to 03157df33d91c039
e[36minfoe[39m: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 wait-for-device
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "echo 'ready'"
e[36minfoe[39m: [debug] Starting logcat capture
e[36minfoe[39m: [debug] Getting device API level
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "getprop ro.build.version.sdk"
e[36minfoe[39m: [debug] Device is at API Level 22
e[36minfoe[39m: Device API level is: 22
e[36minfoe[39m: [debug] Extracting strings for language: default
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "getprop persist.sys.language"
e[36minfoe[39m: [debug] Current device persist.sys.language: en
e[36minfoe[39m: [debug] java -jar "/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" "stringsFromApk" "/Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk" "/tmp/com.weather.Weather" en
e[36minfoe[39m: [debug] No strings.xml for language 'en', getting default strings.xml
e[36minfoe[39m: [debug] java -jar "/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" "stringsFromApk" "/Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk" "/tmp/com.weather.Weather"
e[36minfoe[39m: [debug] Reading strings from converted strings.json
e[36minfoe[39m: [debug] Setting language to default
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 push "/tmp/com.weather.Weather/strings.json" /data/local/tmp
e[36minfoe[39m: [debug] Checking whether aapt is present
e[36minfoe[39m: [debug] Using aapt from /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/build-tools/android-4.2.2/aapt
e[36minfoe[39m: [debug] Retrieving process from manifest.
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/build-tools/android-4.2.2/aapt dump xmltree /Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk AndroidManifest.xml
e[36minfoe[39m: [debug] Set app process to: com.weather.Weather
e[36minfoe[39m: [debug] Not uninstalling app since server not started with --full-reset
e[36minfoe[39m: [debug] Checking app cert for /Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk.
e[36minfoe[39m: [debug] executing cmd: java -jar /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/verify.jar /Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk
e[36minfoe[39m: [debug] App already signed.
e[36minfoe[39m: [debug] Zip-aligning /Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk
e[36minfoe[39m: [debug] Checking whether zipalign is present
e[36minfoe[39m: [debug] Using zipalign from /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/tools/zipalign
e[36minfoe[39m: [debug] Zip-aligning apk.
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/tools/zipalign -f 4 /Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk /var/folders/6y/3w4t1jld3997y9q_6cvwswqr0000gn/T/1151012-86700-apvgbq/appium.tmp
e[36minfoe[39m: [debug] MD5 for app is a79422234f7f3ce0e667e5a6a11929cb
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "ls /data/local/tmp/a79422234f7f3ce0e667e5a6a11929cb.apk"
e[36minfoe[39m: [debug] Getting install status for com.weather.Weather
e[36minfoe[39m: [debug] Getting device API level
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "getprop ro.build.version.sdk"
e[36minfoe[39m: [debug] Device is at API Level 22
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "pm list packages -3 com.weather.Weather"
e[36minfoe[39m: [debug] App is installed
e[36minfoe[39m: [debug] Forwarding system:4724 to device:4724
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 forward tcp:4724 tcp:4724
e[36minfoe[39m: [debug] Pushing appium bootstrap to device...
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 push "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/android_bootstrap/AppiumBootstrap.jar" /data/local/tmp/
e[36minfoe[39m: [debug] Pushing settings apk to device...
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 install "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/settings_apk/settings_apk-debug.apk"
e[36minfoe[39m: [debug] Pushing unlock helper app to device...
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 install "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/unlock_apk/unlock_apk-debug.apk"
e[36minfoe[39m: [debug] Logcat terminated with code 0, signal null
e[36minfoe[39m: Starting App
e[36minfoe[39m: [debug] Attempting to kill all 'uiautomator' processes
e[36minfoe[39m: [debug] Getting all processes with 'uiautomator'
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "ps 'uiautomator'"
e[36minfoe[39m: [debug] No matching processes found
e[36minfoe[39m: [debug] Running bootstrap
e[36minfoe[39m: [debug] spawning: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.weather.Weather -e disableAndroidWatchers false
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunnere[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServere[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrape[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1e[39m
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Loading json...
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] json loading complete.
e[31merrore[39m: Unhandled error: Error: connect ECONNREFUSED
    at exports._errnoException (util.js:746:11)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19) context: [POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/monocept/Documents/workspace_luna/com.android.logcat/APKFile/TWC_511000452_release.apk","appPackage":"com.weather.Weather","appActivity":"com.weather.Weather.app.]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
e[36minfoe[39m: [debug] UiAutomator exited
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "echo 'ping'"
e[36minfoe[39m: error sending command, reconnecting device and retrying: shell "echo 'ping'"
e[36minfoe[39m: [debug] Trying to find a connected android device
e[36minfoe[39m: [debug] Getting connected devices...
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 devices
e[36minfoe[39m: [debug] 1 device(s) connected
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 "shell \"echo 'ping'\""
e[36minfoe[39m: [debug] Error: Command failed: /bin/sh -c /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 "shell \"echo 'ping'\""
Android Debug Bridge version 1.0.31

 -d                            - directs command to the only connected USB device
                                 returns an error if more than one USB device is present.
 -e                            - directs command to the only running emulator.
                                 returns an error if more than one emulator is running.
 -s <specific device>          - directs command to the device or emulator with the given
                                 serial number or qualifier. Overrides ANDROID_SERIAL
                                 environment variable.
 -p <product name or path>     - simple product name like 'sooner', or
                                 a relative/absolute path to a product
                                 out directory like 'out/target/product/sooner'.
                                 If -p is not specified, the ANDROID_PRODUCT_OUT
                                 environment variable is used, which must
                                 be an absolute path.
 devices [-l]                  - list all connected devices
                                 ('-l' will also list device qualifiers)
 connect <host>[:<port>]       - connect to a device via TCP/IP
                                 Port 5555 is used by default if no port number is specified.
 disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.
                                 Port 5555 is used by default if no port number is specified.
                                 Using this command with no additional arguments
                                 will disconnect from all connected TCP/IP devices.

device commands:
  adb push <local> <remote>    - copy file/dir to device
  adb pull <remote> [<local>]  - copy file/dir from device
  adb sync [ <directory> ]     - copy host->device only if changed
                                 (-l means list but don't copy)
                                 (see 'adb help all')
  adb shell                    - run remote shell interactively
  adb shell <command>          - run remote shell command
  adb emu <command>            - run emulator console command
  adb logcat [ <filter-spec> ] - View device log
  adb forward <local> <remote> - forward socket connections
                                 forward specs are one of: 
                                   tcp:<port>
                                   localabstract:<unix domain socket name>
                                   localreserved:<unix domain socket name>
                                   localfilesystem:<unix domain socket name>
                                   dev:<character device name>
                                   jdwp:<process pid> (remote only)
  adb jdwp                     - list PIDs of processes hosting a JDWP transport
  adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
                               - push this package file to the device and install it
                                 ('-l' means forward-lock the app)
                                 ('-r' means reinstall the app, keeping its data)
                                 ('-s' means install on SD card instead of internal storage)
                                 ('--algo', '--key', and '--iv' mean the file is encrypted already)
  adb uninstall [-k] <package> - remove this app package from the device
                                 ('-k' means keep the data and cache directories)
  adb bugreport                - return all information from the device
                                 that should be included in a bug report.

  adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
                               - write an archive of the device's data to <file>.
                                 If no -f option is supplied then the data is written
                                 to "backup.ab" in the current directory.
                                 (-apk|-noapk enable/disable backup of the .apks themselves
                                    in the archive; the default is noapk.)
                                 (-shared|-noshared enable/disable backup of the device's
                                    shared storage / SD card contents; the default is noshared.)
                                 (-all means to back up all installed applications)
                                 (-system|-nosystem toggles whether -all automatically includes
                                    system applications; the default is to include system apps)
                                 (<packages...> is the list of applications to be backed up.  If
                                    the -all or -shared flags are passed, then the package
                                    list is optional.  Applications explicitly given on the
                                    command line will be included even if -nosystem would
                                    ordinarily cause them to be omitted.)

  adb restore <file>           - restore device contents from the <file> backup archive

  adb help                     - show this help message
  adb version                  - show version num

scripting:
  adb wait-for-device          - block until device is online
  adb start-server             - ensure that there is a server running
  adb kill-server              - kill the server if it is running
  adb get-state                - prints: offline | bootloader | device
  adb get-serialno             - prints: <serial-number>
  adb get-devpath              - prints: <device-path>
  adb status-window            - continuously print device status for a specified device
  adb remount                  - remounts the /system partition on the device read-write
  adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
  adb reboot-bootloader        - reboots the device into the bootloader
  adb root                     - restarts the adbd daemon with root permissions
  adb usb                      - restarts the adbd daemon listening on USB
  adb tcpip <port>             - restarts the adbd daemon listening on TCP on the specified port
networking:
  adb ppp <tty> [parameters]   - Run PPP over USB.
 Note: you should not automatically start a PPP connection.
 <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
 [parameters] - Eg. defaultroute debug dump local notty usepeerdns

adb sync notes: adb sync [ <directory> ]
  <localdir> can be interpreted in several ways:

  - If <directory> is not specified, both /system and /data partitions will be updated.

  - If it is "system" or "data", only the corresponding partition
    is updated.

environmental variables:
  ADB_TRACE                    - Print debug information. A comma separated list of the following values
                                 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
  ANDROID_SERIAL               - The serial number to connect to. -s takes priority over this if given.
  ANDROID_LOG_TAGS             - When used with the logcat option, only these debug tags are printed.

e[36minfoe[39m: [debug] Stopping logcat capture
e[36minfoe[39m: [debug] Logcat already stopped
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 kill-server
e[36minfoe[39m: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 wait-for-device
e[36minfoe[39m: [debug] executing cmd: /Users/monocept/Documents/adt-bundle-mac-x86_64-20130522/sdk/platform-tools/adb -s 03157df33d91c039 shell "echo 'ready'"
e[36minfoe[39m: [debug] Starting logcat capture
e[36minfoe[39m: [debug] Attempting to uninstall app
e[36minfoe[39m: [debug] Not uninstalling app since server not started with --full-reset
e[36minfoe[39m: [debug] Cleaning up android objects
e[31merrore[39m: UiAutomator quit before it successfully launched
e[36minfoe[39m: [debug] Cleaning up appium session
e[31merrore[39m: Failed to start an Appium session, err was: Error: UiAutomator quit before it successfully launched
e[36minfoe[39m: [debug] Error: UiAutomator quit before it successfully launched
    at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android.js:205:23)
    at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-hybrid.js:249:5)
    at Object.async.eachSeries (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:142:20)
    at [object Object].androidHybrid.stopChromedriverProxies (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-hybrid.js:233:9)
    at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android.js:200:10)
    at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android.js:222:9)
    at [object Object].androidCommon.uninstallApp (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-common.js:478:5)
    at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android.js:220:12)
    at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android.js:245:15)
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:251:17
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:154:25
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:248:21
    at [object Object].onLogcatStart (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:612:34)
    at [object Object].Logcat.onOutput (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/lib/logcat.js:81:12)
    at [object Object].Logcat.onStdout (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/lib/logcat.js:61:8)
    at Stream.stream.write (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/through/index.js:26:11)
    at Socket.ondata (_stream_readable.js:540:20)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at Pipe.onread (net.js:538:20)
e[36minfoe[39m: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: UiAutomator quit before it successfully launched)","origValue":"UiAutomator quit before it successfully launched"},"sessionId":null}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session e[39me[31m500e[39me[90m 24176.781 ms - 218e[39m e[90me[39m
FAILED: Capabilites
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: UiAutomator quit before it successfully launched) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 24.45 seconds
Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44'
System info: host: 'ravis-MacBook-Pro.local', ip: '172.16.0.5', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11', java.version: '1.8.0_60'
Driver info: io.appium.java_client.android.AndroidDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
    at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:160)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:168)
    at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:69)
    at com.twc.appium.Capabilities_android.dcap(Capabilities_android.java:62)
    at com.twc.appium.Smoke_Test.Capabilites(Smoke_Test.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:659)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
    at org.testng.TestRunner.privateRun(TestRunner.java:771)
    at org.testng.TestRunner.run(TestRunner.java:621)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
    at org.testng.SuiteRunner.run(SuiteRunner.java:259)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
    at org.testng.TestNG.run(TestNG.java:1032)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

Shell_error : Exit status of command 'cordova platform add ios --nofetch' was 1 instead of 0
#17

Well, the solution that works for me is :

  1. go to your project folder, right click and get Info ( be sure to aply read & write to all the folders/sub folders )
  2. try to build/run again, if you get the error of spawn EACCESS do step 3
  3. sudo ionic hooks add and that should solve the issue.

#18

ionic hooks add fixed the problem for me, thanks @KevinYang


#19

can anyone help me? I’m done with my app but cannot add andriod platform
I’m getting that error when running ionic platform add android

/hooks/before_platform_add/init_directories.js Error: spawn EACCES

I followed everything I can search in google for the whole day but still no luck
I already tried “ionic hoooks add” “ionic platform rm android” “ionic platform add android” “sudo
chmod -R a+rwx /appfolder” and others
I also updated everything ionic cordova via npm update


#20

I was facing similar issue running ionic build… Here is the error i see in console
_Running command: …/hooks/after_prepare/010_add_platform_class.js _
Error: spawn EACCES

Solution : running this command chmod +x ~/Documents/…/hooks/after_prepare/010_add_platform_class.js fixed