Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 17, 2025

Problem

The GitHub Actions workflow was failing during the npm install step due to a peer dependency conflict between @nomicfoundation/hardhat-ethers and @nomicfoundation/hardhat-chai-matchers:

npm error ERESOLVE could not resolve
npm error While resolving: @nomicfoundation/[email protected]
npm error Found: @nomicfoundation/[email protected]
npm error Could not resolve dependency:
npm error peer @nomicfoundation/hardhat-ethers@"^3.1.0" from @nomicfoundation/[email protected]

This conflict occurs because:

  • The project uses @nomicfoundation/hardhat-ethers@^4.0.0
  • But @nomicfoundation/hardhat-chai-matchers@^2.1.0 expects @nomicfoundation/hardhat-ethers@^3.1.0

Solution

Added the --legacy-peer-deps flag to all npm install commands in the CI/CD pipeline. This flag instructs npm to use the legacy peer dependency resolution algorithm, which bypasses the strict peer dependency checks and allows the installation to proceed with potentially incompatible peer dependencies.

Changes

  • Updated .github/workflows/auto-assign.yml to add --legacy-peer-deps flag to all three npm install steps:
    • Build job
    • Test job
    • Deploy job
  • Removed an infinite loop from package.json scripts that was causing additional issues

Verification

The fix has been tested and confirmed to work:

  • npm install --legacy-peer-deps successfully installs all dependencies
  • All hardhat packages are correctly installed and available
  • YAML workflow syntax is valid

This is a common and accepted solution for resolving peer dependency conflicts in npm, especially when using packages that haven't been updated to support the latest versions of their peer dependencies.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • binaries.soliditylang.org
    • Triggering command: node /home/REDACTED/work/scripts-deploy.js/scripts-deploy.js/node_modules/.bin/hardhat compile (dns block)
    • Triggering command: node /home/REDACTED/work/scripts-deploy.js/scripts-deploy.js/node_modules/.bin/hardhat test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

This pull request was created as a result of the following prompt from Copilot chat.

The GitHub Actions workflow for this repository is encountering a dependency conflict during the npm install step. This is due to conflicting peer dependencies between @nomicfoundation/hardhat-ethers and @nomicfoundation/hardhat-chai-matchers. The workflow currently lacks the --legacy-peer-deps flag, which can resolve this issue by bypassing the peer dependency checks.

Task:

Update the .github/workflows/auto-assign.yml file to include the --legacy-peer-deps flag in the npm install step. Below is the full updated workflow file:

name: CI/CD Pipeline

on:
  pull_request:
    types: [opened, reopened, synchronize]

jobs:
  auto-assign:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

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

      - name: Install dependencies
        run: npm install --legacy-peer-deps

      - name: Auto assign reviewers
        uses: kentaro-m/auto-assign-action@v1
        with:
          reviewers: 'your-reviewer-username'

Steps to Complete:

  1. Navigate to the .github/workflows/auto-assign.yml file in the repository.
  2. Locate the Install dependencies step.
  3. Add the --legacy-peer-deps flag to the npm install command.
  4. Save and commit the changes with the message: Fix npm install dependency conflict in CI/CD pipeline.
  5. Verify the updated workflow runs successfully.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@github-actions
Copy link

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI changed the title [WIP] Fix npm install dependency conflict in CI/CD pipeline Fix npm install dependency conflict in CI/CD pipeline Sep 17, 2025
Copilot AI requested a review from sonnyquinn24 September 17, 2025 22:39
Copilot finished work on behalf of sonnyquinn24 September 17, 2025 22:39
Copy link
Owner

@sonnyquinn24 sonnyquinn24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo

@sonnyquinn24 sonnyquinn24 marked this pull request as ready for review September 17, 2025 22:50
Copilot AI review requested due to automatic review settings September 17, 2025 22:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes npm dependency conflicts in GitHub Actions workflow by adding the --legacy-peer-deps flag to bypass strict peer dependency checks and removes a problematic infinite loop script.

  • Added --legacy-peer-deps flag to all npm install commands in CI/CD pipeline
  • Removed infinite loop script from package.json that would cause installation issues
  • Ensures CI/CD workflow can proceed despite peer dependency conflicts between hardhat packages

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/auto-assign.yml Added --legacy-peer-deps flag to npm install steps in build, test, and deploy jobs
package.json Removed problematic install script that created an infinite loop

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/fix-db0bbd90-7ed1-485c-b281-eadb839722e0

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants