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.
Error
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
Issue
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.
Fix
# 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
That will correct the specific file in that specific build but will not stop it from happening every time you try and launch your project in the iOS simulator. I’m having the same issue but others on my team is not … any ideas on what’s causing this and how to fix it from happening?
what did you mean by FILE-NAME-WITH-ERROR and FILE-NAME-WITH-ERROR .fix , what is fix ,
if i have filex.js is the file error what the commands will be ?