title: AWS EB deploying Node app: failed to run npm install
body: <p>I am trying to deploy my node app to AWS. It won't even let me deploy the application (stays as <code>Sample Application</code>) using eb deploy.</p>
  
  <p><strong>Version</strong>: 64bit Amazon Linux 2016.09 v4.0.1 running Node.js</p>
  
  <p>The logs say </p>
  
  <blockquote>
    <p>Failed to run npm install</p>
  </blockquote>
  
  <p>But am not too sure what else they're asking me to do to fix it. I can npm install just fine locally:</p>
  
  <pre><code>-------------------------------------
  /var/log/eb-activity.log
  -------------------------------------
    Failed to run npm install. Snapshot logs for more details.
    Traceback (most recent call last):
      File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in &lt;module&gt;
        main()
      File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
        node_version_manager.run_npm_install(options.app_path)
      File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
        self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
      File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
        raise e
    subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin/npm', '--production', 'rebuild']' returned non-zero exit status 1 (Executor::NonZeroExitStatus)
  </code></pre>
  
  <p>A snapshot of the overview page:</p>
  
  <p><a href="https://i.stack.imgur.com/QcMPd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QcMPd.png" alt="enter image description here"></a></p>
  
  <p>Eb deploy failure message:</p>
  
  <pre><code>$ eb deploy
  Creating application version archive "app-bdfdd-170514_152527".
  Uploading: [##################################################] 100% Done...
  INFO: Environment update is starting.                               
  INFO: Deploying new version to instance(s).                         
  ERROR: Failed to run npm install. Snapshot logs for more details.   
  ERROR: [Instance: i-09af789a519075c5e] Command failed on instance. Return code: 1 Output: (TRUNCATED).../opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
      raise e
  subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 1. 
  Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
  INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
  ERROR: Unsuccessful command execution on instance id(s) 'i-09af789a519075c5e'. Aborting the operation.
  ERROR: Failed to deploy application.                                
  
  ERROR: Failed to deploy application.
  </code></pre>
  
  <p>My ebextensions file (at <code>.ebextentions/config.config</code>), default:</p>
  
  <pre><code>packages:
    yum:
      git: []
      cairo: []
      cairo-devel: []
      libjpeg-turbo-devel: []
      giflib-devel: []
  </code></pre>
  
  <p>Package.json file</p>
  
  <pre><code>{
    "name": "live-demos",
    "version": "1.0.0",
    "description": "",
    "main": "app.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1",
      "gulp": "gulp",
      "start": "node app.js",
      "start:dev": "browserify ./js/about.js -o ./build/js/bundle.js &amp;&amp; gulp build-dev"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
      "body-parser": "^1.x.x",
      "browserify": "^13.1.0",
      "canvas": "^1.4.0",
      "d3": "^3.5.17",
      "d3.layout.cloud": "^1.2.0",
      "ejs": "^2.5.1",
      "express": "^4.13.1",
      "gulp": "^3.9.0",
      "gulp-autoprefixer": "^2.3.1",
      "gulp-compass": "^2.1.0",
      "gulp-concat": "^2.6.0",
      "gulp-minify-css": "^1.2.0",
      "gulp-nodemon": "^2.0.4",
      "gulp-sass": "^2.0.4",
      "isotope-layout": "^3.0.1",
      "request": "^2.74.0",
      "request-promise": "^4.1.1"
    },
    "devDependencies": {
      "gulp": "^3.9.0",
      "gulp-browserify": "^0.5.1",
      "gulp-nodemon": "^2.0.4"
    }
  }
  </code></pre>