gemboran / components

Shadcn custom registry with storybook
http://ui.buatan.id/
MIT License
2 stars 0 forks source link

CI CD error when running pnpm build #1

Closed gemboran closed 3 weeks ago

gemboran commented 3 weeks ago
  /home/runner/work/_temp/db514816-03a0-4a1b-9e7c-5fd51856d101.sh: line 2: pnpm: command not found
  Error: Process completed with exit code 127.
codeautopilot[bot] commented 3 weeks ago

Potential solution

The plan to solve the bug involves modifying the CI/CD pipeline configuration file to ensure that pnpm is installed before attempting to run the build process. The error message indicates that the pnpm command is not found, which suggests that pnpm is not installed in the CI environment. By adding a step to install pnpm, we can ensure that the build process has all the necessary tools to execute successfully.

What is causing this bug?

The bug is caused by the absence of pnpm in the CI environment. The error message /home/runner/work/_temp/db514816-03a0-4a1b-9e7c-5fd51856d101.sh: line 2: pnpm: command not found indicates that the pnpm command is not recognized because it is not installed. The CI configuration file .github/workflows/ci.yml does not include a step to install pnpm, leading to the failure of the build process.

Code

To resolve this issue, we need to update the .github/workflows/ci.yml file to include a step for installing pnpm. Here is the updated configuration:

name: CI

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Set up Node.js
      uses: actions/setup-node@v2
      with:
        node-version: '14'

    - name: Install pnpm
      run: npm install -g pnpm

    - name: Install dependencies
      run: pnpm install

    - name: Build
      run: pnpm build

Explanation

  1. Checkout repository: This step checks out the repository to the runner.
  2. Set up Node.js: This step sets up the Node.js environment.
  3. Install pnpm: This step installs pnpm globally using npm.
  4. Install dependencies: This step installs the project dependencies using pnpm.
  5. Build: This step runs the build command using pnpm.

By adding these steps, we ensure that pnpm is installed in the CI environment before the build step is executed, which should resolve the issue.

How to replicate the bug

To replicate the bug, follow these steps:

  1. Set up a GitHub repository with a Node.js project that uses pnpm for package management.
  2. Create a .github/workflows/ci.yml file with a CI/CD pipeline configuration that does not include a step to install pnpm.
  3. Push a commit or create a pull request to trigger the CI/CD pipeline.
  4. Observe the pipeline failure with the error message indicating that pnpm is not found.

Task

User input/request

Ticket title: CI CD error when running pnpm build

Ticket Description:

  /home/runner/work/_temp/db514816-03a0-4a1b-9e7c-5fd51856d101.sh: line 2: pnpm: command not found
  Error: Process completed with exit code 127.

By following the proposed solution and updating the .github/workflows/ci.yml file to include a step for installing pnpm, we can resolve the issue and ensure that the CI/CD pipeline runs successfully.

Click here to create a Pull Request with the proposed solution

Files used for this task:

Changes on .github/workflows/ci.yml # Analysis Report ## File: .github/workflows/ci.yml ### Issue Description The CI/CD pipeline is failing with the error: ``` /home/runner/work/_temp/db514816-03a0-4a1b-9e7c-5fd51856d101.sh: line 2: pnpm: command not found Error: Process completed with exit code 127. ``` This indicates that the `pnpm` command is not found in the CI environment, leading to the failure of the build process. ### Cause of the Bug The error message suggests that `pnpm` is not installed in the CI environment before the build step is executed. This is likely because there is no step in the CI configuration file (`.github/workflows/ci.yml`) to install `pnpm`. ### Solution To resolve this issue, we need to add a step in the CI configuration file to install `pnpm` before the build step. This can be done using a package manager like `npm` or `curl`. ### Suggested Changes Add the following steps to the `.github/workflows/ci.yml` file: ```yaml name: CI on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v2 with: node-version: '14' - name: Install pnpm run: npm install -g pnpm - name: Install dependencies run: pnpm install - name: Build run: pnpm build ``` ### Explanation 1. **Checkout repository**: This step checks out the repository to the runner. 2. **Set up Node.js**: This step sets up the Node.js environment. 3. **Install pnpm**: This step installs `pnpm` globally using `npm`. 4. **Install dependencies**: This step installs the project dependencies using `pnpm`. 5. **Build**: This step runs the build command using `pnpm`. By adding these steps, we ensure that `pnpm` is installed in the CI environment before the build step is executed, which should resolve the issue. ### Conclusion The `.github/workflows/ci.yml` file is missing a step to install `pnpm`, which is causing the CI/CD pipeline to fail. Adding the necessary steps to install `pnpm` will resolve this issue.
gemboran commented 3 weeks ago

Done, I am bump node version to v20 and install pnpm v9.5.0