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

Angular fails to build in EB #72

Closed dbvrac closed 6 years ago

dbvrac commented 7 years ago

Runs just fine locally. This is the log from a clean install, right after running createResources.sh. I tried waiting for it to fail and then specifying Node v7.6.0 in my environment, but nothing changed.

0 info it worked if it ends with ok 1 verbose cli [ '/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin/node', 1 verbose cli '/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin/npm', 1 verbose cli 'run', 1 verbose cli 'build' ] 2 info using npm@3.10.10 3 info using node@v6.10.0 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ] 5 info lifecycle aws-cognito-angular2-quickstart@1.0.0~prebuild: aws-cognito-angular2-quickstart@1.0.0 6 silly lifecycle aws-cognito-angular2-quickstart@1.0.0~prebuild: no script for prebuild, continuing 7 info lifecycle aws-cognito-angular2-quickstart@1.0.0~build: aws-cognito-angular2-quickstart@1.0.0 8 verbose lifecycle aws-cognito-angular2-quickstart@1.0.0~build: unsafe-perm in lifecycle true 9 verbose lifecycle aws-cognito-angular2-quickstart@1.0.0~build: PATH: /opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/lib/node_modules/npm/bin/node-gyp-bin:/tmp/deployment/application/node_modules/.bin:/tmp/deployment/application/node_modules/.bin:/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin:/opt/elasticbeanstalk/lib/rub y/bin:/opt/elasticbeanstalk/lib/ruby/bin:/sbin:/usr/sbin:/bin:/usr/bin 10 verbose lifecycle aws-cognito-angular2-quickstart@1.0.0~build: CWD: /tmp/deployment/application 11 silly lifecycle aws-cognito-angular2-quickstart@1.0.0~build: Args: [ '-c', 'ng build --prod' ] 12 info lifecycle aws-cognito-angular2-quickstart@1.0.0~build: Failed to exec build script 13 verbose stack Error: aws-cognito-angular2-quickstart@1.0.0 build: ng build --prod 13 verbose stack spawn ENOENT 13 verbose stack at ChildProcess. (/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/lib/node_modules/npm/lib/utils/spawn.js:33:16) 13 verbose stack at emitTwo (events.js:106:13) 13 verbose stack at ChildProcess.emit (events.js:191:7) 13 verbose stack at maybeClose (internal/child_process.js:877:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 14 verbose pkgid aws-cognito-angular2-quickstart@1.0.0 15 verbose cwd /tmp/deployment/application 16 error Linux 4.9.27-14.31.amzn1.x86_64 17 error 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" 18 error node v6.10.0 19 error npm v3.10.10 20 error file sh 21 error code ELIFECYCLE 22 error errno ENOENT 23 error syscall spawn 24 error aws-cognito-angular2-quickstart@1.0.0 build: ng build --prod 24 error spawn ENOENT 25 error Failed at the aws-cognito-angular2-quickstart@1.0.0 build script 'ng build --prod'. 25 error Make sure you have the latest version of node.js and npm installed. 25 error If you do, this is most likely a problem with the aws-cognito-angular2-quickstart package, 25 error not with npm itself. 25 error Tell the author that this fails on your system: 25 error ng build --prod 25 error You can get information on how to open an issue for this project with: 25 error npm bugs aws-cognito-angular2-quickstart 25 error Or if that isn't available, you can get their info via: 25 error npm owner ls aws-cognito-angular2-quickstart 25 error There is likely additional logging output above. 26 verbose exit [ 1, true ]

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?

dbvrac commented 7 years ago

$ git clone --depth 1 git@github.com:awslabs/aws-cognito-angular2-quickstart.git OK $ cd aws-cognito-angular2-quickstart OK $ npm install OK $ npm start OK - runs locally, ^c. Now cd to aws/ $ ./createResources.sh WAIT a long time, resources get created (load balancer, instance, DB, S3 bucket), but app fails to build with NPM errors. I tried several times, from scratch.

meayyappa commented 7 years ago

Dear @vbudilov,

Tried latest code. But i'm not able to deploy the application.

Please find the log,

Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/55_build_angular.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]. WARN: Environment health has transitioned from Pending to Degraded. Command failed on all instances. Initialization completed 10 seconds ago and took 4 minutes. ERROR: Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

Thank you, Ayyappa.

vbudilov commented 7 years ago

Can you get the latest code and try again?