‘The deployment failed because a specified file already exists at this location’
See this for an explanation of why this error appears
Fix for me was to add the following to my appspec.yml
rm -rf /home/ec2-user/node
The /home/ec2-user/node should be replaced with the directory in which you need to clear the contents
‘$’\r’: command not found’
Line-end in Linux is ‘\n’ while in Windows it is ‘\r\n’.
In our case, the scripts to run during a Codedeploy had come into contact with an editor on a Windows machine. This through the editing of the file out and extra formatting introduced.
When the script was run, the linux machine had trouble with the \r character