amazon-archives / aws-cognito-angular-quickstart

An Angular(v5)-based QuickStart single-page app utilizing Amazon Cognito, S3, and DynamoDB (Serverless architecture)
https://cognito.budilov.com
Apache License 2.0
689 stars 302 forks source link

Command eb deploy fails, ng not found in container #74

Closed svenakela closed 6 years ago

svenakela commented 7 years ago

Building and running according to readme works fine. Running createResources.sh with eb option seems to work but the container fails in AWS stating ng does not exist. This is the output from the container:

... with exit status 1 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/55_build_angular.sh failed.

++ /opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir

  • EB_APP_CURRENT_DIR=/var/app/current ++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir
  • EB_APP_STAGING_DIR=/tmp/deployment/application ++ /opt/elasticbeanstalk/bin/get-config container -k app_user
  • EB_APP_USER=nodejs
  • EB_APP_STAGING_NM_DIR=/tmp/deployment/application/node_modules/.bin ++ /opt/elasticbeanstalk/bin/get-config container -k nodejs_install_dir
  • NODE_PATH=/opt/elasticbeanstalk/node-install ++ head -1 ++ ls -td /opt/elasticbeanstalk/node-install/node-v4.6.1-linux-x64 /opt/elasticbeanstalk/node-install/node-v4.8.0-linux-x64 /opt/elasticbeanstalk/node-install/node-v5.12.0-linux-x64 /opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64 /opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64 /opt/elasticbeanstalk/node-install/node-v7.6.0-linux-x64
  • NODE_PATH_FULL=/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin
  • export PATH=/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
  • PATH=/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
  • export PATH=/tmp/deployment/application/node_modules/.bin:/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
  • PATH=/tmp/deployment/application/node_modules/.bin:/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
  • cd /tmp/deployment/application
  • npm run build

aws-cognito-angular2-quickstart@1.0.0 build /tmp/deployment/application ng build --prod

sh: ng: command not found

npm ERR! Linux 4.9.27-14.31.amzn1.x86_64 npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin/npm" "run" "build" ... Instance ELB health state has been "OutOfService" for 4 minutes: Instance has failed at least the UnhealthyThreshold number of health checks consecutively.

vbudilov commented 7 years ago

You have to install the ng command. Take a look at the "required tools" section here: https://github.com/awslabs/aws-cognito-angular2-quickstart#required-tools

svenakela commented 7 years ago

I have the ng command and it works fine locally. It is the AWS container that fails.

jiajing28 commented 7 years ago

This sample app is set up to build dynamically when it is deployed to Elastic Beanstalk. This removes the need to run npm run build locally before deployment.

Because of this, you have to move the devDependencies in package.json to dependencies so they can be installed when Beanstalk builds angular.

vbudilov commented 7 years ago

Mind getting the latest code and trying it now?