Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build_Folder_Non_Zero_Exit_Code #3849

Closed
5 tasks done
mcdeagles opened this issue Dec 10, 2023 · 3 comments
Closed
5 tasks done

Build_Folder_Non_Zero_Exit_Code #3849

mcdeagles opened this issue Dec 10, 2023 · 3 comments
Labels
archived This issue has been locked. pending-triage

Comments

@mcdeagles
Copy link

Before opening, please confirm:

  • I have checked to see if my question is addressed in the FAQ.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

App Id

NEW_APP

AWS Region

us-east-1

Amplify Hosting feature

Build settings

Frontend framework

JavaScript

Next.js version

N/A

Next.js router

N/A

Describe the bug

Front End BUILD FAILED, NON ZERO EXIT CODE DETECTED. Tried to update build settings to choose proper artifact folder. Decided to create folder during prebuild and move files in.

Expected behavior

Build was supposed to succeed.

Reproduction steps

  1. Modify build settings artifact field to build root directory.
  2. Run Build
  3. Non Zero Exit code

Build Settings

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
        - mkdir -p build
        - cp * build -r
        
    # IMPORTANT - Please verify your build commands
    build:
      commands: []
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Log output

# Put your logs below this line
                                 # Starting phase: preBuild
                                 # Executing command: npm ci
2023-12-10T01:59:46.403Z [INFO]: added 9 packages, and audited 10 packages in 2s
2023-12-10T01:59:46.405Z [INFO]: 1 package is looking for funding
                                 run `npm fund` for details
                                 found 0 vulnerabilities
2023-12-10T01:59:46.409Z [INFO]: # Executing command: mkdir -p build
2023-12-10T01:59:46.413Z [INFO]: # Executing command: cp * build -r
2023-12-10T01:59:46.417Z [WARNING]: cp: cannot copy a directory, ‘build’, into itself, ‘build/build’
2023-12-10T01:59:46.482Z [ERROR]: !!! Build failed
2023-12-10T01:59:46.482Z [ERROR]: !!! Non-Zero Exit Code detected
2023-12-10T01:59:46.482Z [INFO]: # Starting environment caching...
2023-12-10T01:59:46.482Z [INFO]: # Environment caching completed
Terminating logging...

Additional information

Question: How do you find the root build directory to use in the artifact build setting. I created my own build folder instead.

@Jay2113
Copy link
Contributor

Jay2113 commented Feb 8, 2024

Hi @mcdeagles 👋 , thanks for reaching out. The default build directory for your app will vary based on your app framework. For example, if you are building a react app via CRA it will generate a build directory for your artifacts when you do a production build via npm run build. If you want to use a custom folder instead of build for the output, you can achieve this via either of the methods:

build:
  commands:
     - npm run build
     - mkdir -p custom_folder
     - mv build custom_folder
  artifacts:
    baseDirectory: custom_folder

@Jay2113 Jay2113 closed this as completed Feb 8, 2024
Copy link

github-actions bot commented Feb 8, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Copy link

github-actions bot commented Feb 8, 2024

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Feb 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. pending-triage
Projects
None yet
Development

No branches or pull requests

2 participants