I was getting this error off and on. It caused a bunch of delays for me so wanted to post to help out if someone else was running into this.
On OSX Mavericks after
ionic build/run ios
> ionic build ios env: node\r: No such file or directory Error: Hook failed with error code 127: /hooks/after_prepare/010_add_platform_class.js
This is due to to OSX ^M line endings that were committed to my project in this file. For some reason they seem to pop up in this file only, although I have seen some SO posts where people are having the problem on other node scripts.
# check if the file has ^M line endings cat -v FILE-NAME-WITH-ERROR # fix the file tr -d '\r' < FILE-NAME-WITH-ERROR > FILE-NAME-WITH-ERROR.fix # check if problem fixed in resulting file from above cat -v FILE-NAME-WITH-ERROR.fix # overwrite original file with fixed file mv FILE-NAME-WITH-ERROR.fix FILE-NAME-WITH-ERROR
Hope this helps.