aws-samples / aws-bookstore-demo-app

AWS Bookstore Demo App is a full-stack sample web application that creates a storefront (and backend) for customers to shop for fictitious books. The entire application can be created with a single template. Built on AWS Full-Stack Template.
MIT No Attribution
622 stars 305 forks source link

CodeBuild Fails COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run build. Reason: exit status 1 #40

Closed sangramthorat closed 1 year ago

sangramthorat commented 1 year ago

Project create CodePipeline project. CodeBuild Fails with the following error...

Creating an optimized production build...

146 | Failed to compile. 147 |   148 | /codebuild/output/src062423328/src/node_modules/@types/babel__traverse/index.d.ts 149 | TypeScript error in /codebuild/output/src062423328/src/node_modules/@types/babel__traverse/index.d.ts(68,50): 150 | ']' expected. TS1005 151 |   152 | 66 | } 153 | 67 | 154 | > 68 | export type ArrayKeys = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P }; 155 | | ^ 156 | 69 | 157 | 70 | export class Scope { 158 | 71 | constructor(path: NodePath, parentScope?: Scope); 159 |   160 |   161 | npm ERR! code ELIFECYCLE 162 | npm ERR! errno 1 163 | npm ERR! aws-bookstore-demo-app@0.1.0 build: react-scripts build 164 | npm ERR! Exit status 1 165 | npm ERR! 166 | npm ERR! Failed at the aws-bookstore-demo-app@0.1.0 build script. 167 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 168 |   169 | npm ERR! A complete log of this run can be found in: 170 | npm ERR! /root/.npm/_logs/2023-01-12T21_39_57_365Z-debug.log 171 |   172 | [Container] 2023/01/12 21:39:57 Command did not exit successfully npm run build exit status 1 173 | [Container] 2023/01/12 21:39:57 Phase complete: BUILD State: FAILED 174 | [Container] 2023/01/12 21:39:57 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run build. Reason: exit status 1

image image
shaidar commented 1 year ago

Running into the same error. Were you able to resolve it?

jdmc-aws commented 1 year ago

Getting this same error. Anyone manage to resolve it?

nathanle commented 1 year ago

Same error. Tried updating the package versions and it did not change anything.

triggan commented 1 year ago

Hi all. Thanks for submitting this. I'll try to take a look at this later today or tomorrow and provide a fix.

triggan commented 1 year ago

This has been fixed. For future reference, we create a ZIP file located at https://s3.amazonaws.com/aws-bookstore-demo/bookstore-webapp.zip which should contain the same contents as what is in the /assets directory of this repo. This pertains to the front-end code for the Bookstore App. When deploying the stack, that ZIP file is used to seed a CodeCommit repo with this code, use CodePipeline & CodeBuild to build the frontend, and then deploy the build to the assets S3 bucket in the stack. That assets bucket is then presented to the user via a CloudFront distribution. The code base here in GitHub was not in-sync with the ZIP file on S3. These are now in-sync. We need to figure out a better way to automate changes from GitHub being used to either update that ZIP file, or being used directly to create the CodeCommit repo in a launched stack.