title: Deployment failed-Script at specified location: start.sh run as user ec2-user failed with exit code 127
body: <p>I am trying to deploy code from GitHub to CodeDeploy in AWS Amazon.
  I have sample HelloWorld application.I have appspec.yml that looks like this:</p>
  
  <pre><code>os: linux
  
  files:
    - source: /
      destination: /home/ec2-user/server
  
  permissions:
    - object: /
      pattern: "**"
      owner: ec2-user
      group: ec2-user
  
  hooks:
    ApplicationStop:
      - location: stop.sh
        timeout: 20
        runas: ec2-user
    ApplicationStart:
      - location: start.sh
        timeout: 20
        runas: ec2-user
    ValidateService:
      - location: validate.sh
        timeout: 120
        runas: ec2-user
  </code></pre>
  
  <p>and buldspec.yml:</p>
  
  <pre><code>
  phases:
    install:
      runtime-versions:
        java: openjdk8
    build:
      commands:
        - mvn clean package --quiet
  artifacts:
    discard-paths: yes
    files:
      - target/*
      - scripts/*
      - appspec.yml
  </code></pre>
  
  <p>start.sh</p>
  
  <pre><code>
  
  cd /home/ec2-user/server
  sudo /usr/bin/java -jar -Dserver.port=80 \
      *.jar &gt; /dev/null 2&gt; /dev/null &lt; /dev/null &amp;
  </code></pre>
  
  <p>stop.sh:</p>
  
  <pre><code>
  #!/usr/bin/env bash
  
  sudo killall java
  exit 0
  </code></pre>
  
  <p>and validate.sh:</p>
  
  <pre><code>#!/bin/bash
  
  echo "Waiting for 15 seconds before checking health.."
  sleep 15
  
  status_code=$(curl --write-out %{http_code} --silent --output /dev/null http://localhost:80)
  if [[ "$status_code" -ne 200 ]] ; then
    echo "App is not healthy - $status_code"
    exit 1
  else
    echo "App is responding with $status_code"
    exit 0
  fi
  
  </code></pre>
  
  <p>My deployment failed and error says:</p>
  
  <p>Script at specified location: start.sh run as user ec2-user failed with exit code 127
  Logs
  LifecycleEvent - ApplicationStart
  Script - start.sh
  [stderr]/usr/bin/env: bash : No such file or directory</p>
  
  <p>please can someone help me</p>