Angular universal build command to include package.json at root level of dist folder

I see you are trying to run main js file which is generated after build in case of ssr. To run that you need a script or Procfile as per aws documentation. To do this I added Procfile to my s3 bucket and then run the build command

buildspec file

        - echo Build started 
        - npm run build:ssr
        - aws s3 cp s3://yourbucketname/Procfile ./dist
        - bash -c "if [ /"$CODEBUILD_BUILD_SUCCEEDING/" == /"0/" ]; then exit 1; fi"
        # - aws s3 rm s3:// --recursive
        - echo S3 bucket is cleared.
        # - aws cloudfront create-invalidation --distribution-id=E26GLI30EJTNBB --paths '/*'
        - '**/*'
    base-directory: 'dist'

Also, don’t forget to add the permission in your s3 bucket like below

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:*",
            "Resource": [

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top