11
votes

Whenever I use ionic platform add [platformname] It gives me this error

Error: spawn EACCES
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1155:11)
at Object.exports.spawn (child_process.js:988: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)

2
Have a look to my other answer [here][1] [1]: stackoverflow.com/a/29467053/21548bernardn

2 Answers

7
votes

I was getting a bunch of errors when i emulate the project (iOS). After 1 day. I found with my boss that if you apply "chmod -Rv 755 inside the ionic proyect folder, it's going to work like a charm!.

Steps:

  1. Install node.js, cordova, ionic, iOS-sim
  2. ionic start "project name" "template"
  3. cd "project path"
  4. chmod -Rv 755 * (change permissions inside the project folder scope)
  5. ionic platform add iOS (in this case)
  6. ionic build iOS
  7. ionic emulate iOS

And it will work.

Hope if this helps

30
votes

It seems that the unpacked project has incorrect permissions. This answer suggested to change the permissions of hooks/after_prepare/010_add_platform_class.js to 755. But the solution from the Ioinc forum showed another easy way to solve this -- just run

ionic hooks add

after you create the project and change to your project directory. Then run:

ionic platform add ios

will success without errors.