question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple NPM Install errors, not working with Node 16.x

See original GitHub issue

Describe a bug

Trying to have the report action work in our NestJS repository, tried many variations but those error when it gets to the NPM install steps.

Details

  • Action version: Tried with 2.0rc4, rc6 and 2.0.8

  • OS, where your action is running (windows, linux): linux

  • action.yml file
    ```yml
    name: 'coverage'
      on:
        push:
      
      jobs:
        coverage:
          permissions:
            checks: write
            pull-requests: write
            contents: write
          runs-on: ubuntu-latest
          steps:
            - uses: actions/checkout@v2
            - uses: ArtiomTr/jest-coverage-report-action@v2.0.8
    ```
    

Additional context

Error example:

Run ArtiomTr/jest-coverage-report-action@v2.0.8
Run $GITHUB_ACTION_PATH/run.sh
Running using node v16.15.1
Begin initialization stage...
Initialization stage ended
Begin stages.parsethreshold...
stages.parseThreshold ended
Begin head coverage collection...
Begin installing dependencies...
/usr/local/bin/npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: traba-server-node@1.0.50
npm ERR! Found: @typescript-eslint/parser@5.14.0
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   dev @typescript-eslint/parser@"^5.8.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/parser@"^4.0.0" from @typescript-eslint/eslint-plugin@4.33.0
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR!   dev @typescript-eslint/eslint-plugin@"^4.28.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-07-08T16_09_11_723Z-debug-0.log
Installing dependencies failed
Error: Error: The process '/usr/local/bin/npm' failed with exit code 1
Error: The process '/usr/local/bin/npm' failed with exit code 1
    at jp._setResult (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:10:17263)
    at jp.CheckComplete (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:10:1[68](https://github.com/trabapro/traba-server-node/runs/7254787340?check_suite_focus=true#step:3:68)53)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:10:15846)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
Installing dependencies ended
Begin running tests...
/usr/local/bin/npx jest --ci --json --coverage --testLocationInResults --outputFile=report.json
npm WARN exec The following package was not found and will be installed: jest
● Multiple configurations found:
    * /home/runner/work/traba-server-node/traba-server-node/jest.config.js
    * `jest` key in /home/runner/work/traba-server-node/traba-server-node/package.json
  Implicit config resolution does not allow multiple configuration files.
  Either remove unused config files or select one explicitly with `--config`.
  Configuration Documentation:
  https://jestjs.io/docs/configurati
Running tests failed
Error: Error: The process '/usr/local/bin/npx' failed with exit code 1
Error: The process '/usr/local/bin/npx' failed with exit code 1
    at jp._setResult (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:10:17263)
    at jp.CheckComplete (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:10:16853)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:10:15846)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
Running tests ended
Begin collecting coverage...
Loading code coverage from file: report.json
Collecting coverage failed
Error: Coverage output file not found. (file "report.json" not found)
Error: Coverage output file not found. (file "report.json" not found)
    at r5 (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:50:324)
    at async je (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:51:156)
    at async Fd (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:51:625)
    at async /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:52:983
    at async je (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:51:156)
    at async Ow (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:52:948)
Collecting coverage ended
Begin parsing coverage...
Parsing coverage skipped
Parsing coverage ended
Head coverage collection failed
Error: Getting code coverage data failed.
Error: Getting code coverage data failed.
    at Fd (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:51:[76](https://github.com/trabapro/traba-server-node/runs/7254787340?check_suite_focus=true#step:3:77)0)
    at async /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:52:983
    at async je (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:51:156)
    at async Ow (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:52:[94](https://github.com/trabapro/traba-server-node/runs/7254787340?check_suite_focus=true#step:3:96)8)
Head coverage collection ended
Begin switching to base branch...
Switching to base branch skipped
Switching to base branch ended
Begin base coverage collection...
Base coverage collection skipped
Base coverage collection ended
Begin switching back to original branch...
Switching back to original branch skipped
Switching back to original branch ended
Begin stages.checkthreshold...
stages.checkThreshold skipped
stages.checkThreshold ended
Begin generating report...
Generating report failed
Error: TypeError: Cannot read properties of undefined (reading 'success')
TypeError: Cannot read properties of undefined (reading 'success')
    at Km (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:49:289)
    at /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:52:1515
    at je (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:51:162)
    at Ow (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.8/dist/index.js:52:1[47](https://github.com/trabapro/traba-server-node/runs/7254787340?check_suite_focus=true#step:3:49)7)
Generating report ended
Begin report publish...
Report publish skipped
Report publish ended
Begin failed tests' annotations publication...
Failed tests' annotations publication skipped
Failed tests' annotations publication ended
Begin coverage annotations publication...
Coverage annotations publication skipped
Coverage annotations publication ended
Error: Jest coverage report action failed
Error: Process completed with exit code 1.

One more error running with the example from the documentation:

Run npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: traba-server-node@1.0.50
npm ERR! Found: @typescript-eslint/parser@5.1[4](https://github.com/trabapro/traba-server-node/runs/7254890884?check_suite_focus=true#step:4:5).0
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   dev @typescript-eslint/parser@"^[5](https://github.com/trabapro/traba-server-node/runs/7254890884?check_suite_focus=true#step:4:6).8.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/parser@"^4.0.0" from @typescript-eslint/eslint-plugin@4.33.0
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR!   dev @typescript-eslint/eslint-plugin@"^4.28.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-07-08T1[6](https://github.com/trabapro/traba-server-node/runs/7254890884?check_suite_focus=true#step:4:7)_16_59_8[7](https://github.com/trabapro/traba-server-node/runs/7254890884?check_suite_focus=true#step:4:8)[9](https://github.com/trabapro/traba-server-node/runs/7254890884?check_suite_focus=true#step:4:10)Z-debug-0.log
Error: Process completed with exit code 1.

This variation works if I used Node 14, but we need to test with Node 16

name: Jest Coverage
on: ['push']

jobs:
  coverage:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
      - uses: actions/checkout@v2
      - run: git fetch --prune --unshallow

      - name: User Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}

      # - run: yarn install --frozen-lockfile

      - uses: ArtiomTr/jest-coverage-report-action@v2.0-rc.6
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MorenoMdzcommented, Jul 9, 2022

Small update, got it to run with this workflow:

name: 'coverage'
on:
  pull_request:
    branches:
      - master
      - main

jobs:
  coverage:
    permissions:
      checks: write
      pull-requests: write
      contents: write
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - run: git fetch --prune --unshallow

      - name: Use Node.js 16.14.0
        uses: actions/setup-node@v2
        with:
          node-version: 16.14.0

      - uses: ArtiomTr/jest-coverage-report-action@v2
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          package-manager: yarn

0reactions
MorenoMdzcommented, Jul 13, 2022

@MorenoMdz, yeah, the error messages are quite confusing. That’s because jest always returns exit code 1, no matter what caused exit: tests fail - exit code 1, coverage thresholds not met - exit code 1, test crash - exit code 1. So with the current action’s architecture, there is no possibility to extract detailed error messages from the command output.

Interesting… Got it, thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common errors
Some strange issues can be resolved by simply running npm cache clean and trying again. · If you are having trouble with npm...
Read more >
node.js - NodeJS - Error installing with NPM
I am installing a certain NodeJS script - Caress. But i am not unable to. I am using Windows 8.1, can anyone tell...
Read more >
[BUG] npm install will randomly hang forever and cannot ...
In my experience, this behavior ocurrs when execute npm install or npm uninstall in a windows console that not is maximized (cmd, powershell, ......
Read more >
How to fix npm install command not working
The error above happens when npm can't be found under the PATH environment variable. First, you need to make sure that npm is...
Read more >
NodeJS - npm install errors on Windows - YouTube
NOTE: If you are using Windows 10, you will want to open an Administrator PowerShell (right-click and choose "Run as administrator").
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found