Deploying to AWS Elastic Beanstalk

Hello,

I have a new hello world type application that uses react on rails. I am trying to deploy it to AWS with Elastic Beanstalk. During the deployment process I’m getting the following error and stack trace. Does anyone have suggestions for deploying to Elastic Beanstalk or best practices to make it work? Thanks in advance.

+ su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp
  cd client && npm run build:production
  
  > react-webpack-rails-tutorial@0.0.1 build:production /var/app/ondeck/client
  > NODE_ENV=production webpack --config webpack.config.js
  
  sh: webpack: command not found
  
  npm ERR! Linux 4.4.41-36.55.amzn1.x86_64
  npm ERR! argv "/opt/elasticbeanstalk/support/node-install/node-v4.6.0-linux-x64/bin/node" "/usr/bin/npm" "run" "build:production"
  npm ERR! node v4.6.0
  npm ERR! npm  v2.15.9
  npm ERR! file sh
  npm ERR! code ELIFECYCLE
  npm ERR! errno ENOENT
  npm ERR! syscall spawn
  npm ERR! react-webpack-rails-tutorial@0.0.1 build:production: `NODE_ENV=production webpack --config webpack.config.js`
  npm ERR! spawn ENOENT
  npm ERR! 
  npm ERR! Failed at the react-webpack-rails-tutorial@0.0.1 build:production script 'NODE_ENV=production webpack --config webpack.config.js'.
  npm ERR! This is most likely a problem with the react-webpack-rails-tutorial package,
  npm ERR! not with npm itself.
  npm ERR! Tell the author that this fails on your system:
  npm ERR!     NODE_ENV=production webpack --config webpack.config.js
  npm ERR! You can get information on how to open an issue for this project with:
  npm ERR!     npm bugs react-webpack-rails-tutorial
  npm ERR! Or if that isn't available, you can get their info via:
  npm ERR! 
  npm ERR!     npm owner ls react-webpack-rails-tutorial
  npm ERR! There is likely additional logging output above.
  
  npm ERR! Please include the following file with any support request:
  npm ERR!     /var/app/ondeck/client/npm-debug.log
  rake aborted!
  Command failed with status (1): [cd client && npm run build:production...]
  /opt/rubies/ruby-2.3.1/bin/bundle:23:in `load'
  /opt/rubies/ruby-2.3.1/bin/bundle:23:in `<main>'
  Tasks: TOP => assets:precompile => react_on_rails:assets:compile_environment => react_on_rails:assets:webpack
  (See full trace by running task with --trace) (Executor::NonZeroExitStatus)

Please see this PR:

and study the discussion…

I look forward to your feedback. The team at ShakaCode.com largely has experience with Heroku, where the deployment “just works” out of the box.

BTW – if webpack is not found, you probably did not install it!

You need to run something like yarn install or npm install early in your deployment.