Skip to content

npm cache does not speed up npm install #385

@ugultopu

Description

@ugultopu

Description:
Consider the following builds:

These two repositories are almost identical, with the only difference being the latter repository caches npm via the setup-node GitHub Action, whereas the former one does not. In other words, the only difference between the repositories is at the .github/workflows/main file:

name: Build Pipeline
on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '11'
          # Following line is present only on the latter repository
          cache: 'npm'
      - run: npm install
      - run: npm run build

Although the build at "setup-node-with-cache" successfully uses npm cache (as evident by the output of the Run actions/setup-node@v2 step), run time of Run npm install step is almost the same as the corresponding step of the build at "setup-node-without-cache".

Isn’t the run time of Run npm install step of the build at "setup-node-with-cache" supposed to be significantly shorter than the corresponding step of the build at "setup-node-without-cache", since it is supposed to use the cached npm packages? Am I missing something here?

Action version:
2

Platform:
Ubuntu

Runner type:
Hosted

Tools version:
Node 11 and default npm that comes with it.

Repro steps:

Expected behavior:
The npm install step of the build that uses the cached npm to be quicker.

Actual behavior:
The npm install step of the build that uses the cached npm is (virtually) the same as the non-cached version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions