actions / setup-node

Set up your GitHub Actions workflow with a specific version of node.js
MIT License
3.78k stars 1.24k forks source link

npm ci hangs in workflow for certain versions of node #1097

Open lamontadams opened 1 month ago

lamontadams commented 1 month ago

Description: For certain versions of node, npm ci hangs until github kills the workflow (about 6 hours).

Failing versions:

Working versions:

npm ci runs successfully for the same package.json locally on all of the above identified failing versions.

Action version: Currently 4.0.2, observed same behavior with version 3 and 2.

Platform:

Runner type:

Tools version: npm package manager, failure noted with node version 18 and 21.

Repro steps:
Workflow yaml - this uses v3 of the action but as stated above, I have seen this issue with versions 2 and 4.02 (which I understand to be the current latest):

jobs:
  build_and_push:
    runs-on: ubuntu-latest
    environment: qa
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '21'
          scope: '@recurate'
          registry-url: 'https://npm.pkg.github.com'

      - name: Install Dependencies and Build
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_ENV: qa
        run: |
          npm ci
          npm run build

Expected behavior: npm ci executes correctly

Actual behavior: npm ci outputs some (sadly expected) warnings and hangs until the workflow execution is terminated.

Current runner version: '2.317.0'
Operating System
Runner Image
Runner Image Provisioner
GITHUB_TOKEN Permissions
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:f43a0e5ff2bd294095638e18286ca9a3d1956744)
Download action repository 'actions/setup-node@v3' (SHA:1a4442cacd436585916779262731d5b162bc6ec7)
Complete job name: build_and_push
3s
Run actions/checkout@v3
Syncing repository: recurate/core-admin-dashboard
Getting Git version info
Temporarily overriding HOME='/home/runner/work/_temp/30272686-482e-40ce-bf14-1823932ef51f' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /home/runner/work/core-admin-dashboard/core-admin-dashboard
Deleting the contents of '/home/runner/work/core-admin-dashboard/core-admin-dashboard'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
Determining the checkout info
Checking out the ref
/usr/bin/git log -1 --format='%H'
'd916c5006fee2adde84426194bd0269bb960fe82'
5s
Run actions/setup-node@v3
Attempting to download 21...
Not found in manifest. Falling back to download directly from Node
Acquiring 21.7.3 - x64 from https://nodejs.org/dist/v21.7.3/node-v21.7.3-linux-x64.tar.gz
Extracting ...
/usr/bin/tar xz --strip 1 --warning=no-unknown-keyword -C /home/runner/work/_temp/88413323-87b7-44f9-8105-55eb929b8002 -f /home/runner/work/_temp/b355c15b-f014-46d6-abb3-02247f2872dc
Adding to the cache ...
Done
Environment details
  node: v21.7.3
  npm: 10.5.0
  yarn: 1.22.22

  Run 
  npm ci
  npm run build
  shell: /usr/bin/bash -e {0}
  env:
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: ***
    RECURATE_NPM_TOKEN: ***
    GITHUB_TOKEN: ***
    NODE_ENV: qa

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: create-react-context@0.3.0
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   40 more (@emotion/react, @emotion/styled, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from create-react-context@0.3.0
npm WARN node_modules/react-form-validator-core/node_modules/create-react-context
npm WARN   create-react-context@"^0.3.0" from react-form-validator-core@1.1.2
npm WARN   node_modules/react-form-validator-core
npm WARN 
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from create-react-context@0.3.0
npm WARN   node_modules/react-form-validator-core/node_modules/create-react-context
npm WARN     create-react-context@"^0.3.0" from react-form-validator-core@1.1.2
npm WARN     node_modules/react-form-validator-core
HarithaVattikuti commented 1 month ago

Hello @lamontadams Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

aparnajyothi-y commented 2 weeks ago

Hello @lamontadams, Thank you once again for creating this issue, we have tried to reproduce the issue but the workflow run is successful within few seconds without any hang and we are unable to see the warning for Node.js versions 21 and 18 for v4. Please find the below screenshots for reference. The warning messages indicate that there is a peer dependency conflict with the react version. This is not an error but a warning that can be resolved by adjusting dependencies.

Image

Image

Image

To resolve this issue, you can use --legacy-peer-deps flag with npm ci to install dependencies ignoring peer dependency conflicts:

Updated Workflow Configuration jobs: build_and_push: runs-on: ubuntu-latest environment: qa steps:

Please update us if this workaround fix your issue.

lamontadams commented 2 weeks ago

Thanks! We will give this a try and let you know what happens.

On Fri, Jul 19, 2024 at 7:57 AM aparnajyothi-y @.***> wrote:

Hello @lamontadams https://github.com/lamontadams, Thank you once again for creating this issue, we have tried to reproduce the issue but the workflow run is successful within few seconds without any hang and we are unable to see the warning for Node.js versions 21 and 18 for v4. Please find the below screenshots for reference. The warning messages indicate that there is a peer dependency conflict with the react version. This is not an error but a warning that can be resolved by adjusting dependencies.

image.png (view on web) https://github.com/user-attachments/assets/fc72a482-7b98-4aad-bd26-ea61e2fcd55d

image.png (view on web) https://github.com/user-attachments/assets/d3c62743-6884-498d-82d2-3c4fb9091cbc

image.png (view on web) https://github.com/user-attachments/assets/fb5ce977-8d82-4b67-9036-ee83dc6e60a2

To resolve this issue, you can use --legacy-peer-deps flag with npm ci to install dependencies ignoring peer dependency conflicts:

Updated Workflow Configuration jobs: build_and_push: runs-on: ubuntu-latest environment: qa steps:

  • name: Checkout code uses: @.***

    • name: Set up Node.js uses: @. with: node-version: '21' scope: @.' registry-url: 'https://npm.pkg.github.com'

    • name: Install Dependencies and Build env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_ENV: qa run: | npm ci --legacy-peer-deps npm run build

This should bypass the peer dependency conflict warnings and proceed with the installation and build process.

Please update us if this workaround fix your issue.

— Reply to this email directly, view it on GitHub https://github.com/actions/setup-node/issues/1097#issuecomment-2238985002, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJEQA6NKBTZLPHVUYTF6ADZND5LHAVCNFSM6AAAAABKCFNFP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZYHE4DKMBQGI . You are receiving this because you were mentioned.Message ID: @.***>

aparnajyothi-y commented 4 days ago

Hello @lamontadams, Please check and update the workaround fix the issue.

lamontadams commented 4 days ago

Hi there. I have heard that it does indeed work. Thank you!Sent from my iPhoneOn Jul 31, 2024, at 10:13 AM, aparnajyothi-y @.***> wrote: Hello @lamontadams, Please check and update the workaround fix the issue.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>