title: Gitlab CI - caching Node.js dependencies
body: <p>I'm having significant problems trying to reuse the packages installed with <code>npm ci</code> between jobs. I have been following this documentation: <a href="https://docs.gitlab.com/ee/ci/caching/#cache-nodejs-dependencies" rel="nofollow noreferrer">https://docs.gitlab.com/ee/ci/caching/#cache-nodejs-dependencies</a>, but the packages are reinstalled each step anyway:</p>
  <pre><code>$ npm ci --cache node_modules --prefer-offline
  added 1895 packages, and audited 1896 packages in 41s
  </code></pre>
  <p>Here's my yaml. The files are within a folder called <code>frontend</code>.</p>
  <pre><code>stages:
    - lint
    - test
    - build
    
  image: node:15-alpine
  
  # Cache modules in between jobs
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - frontend/.npm/
  
  before_script:
    - cd frontend
    - npm ci --cache .npm --prefer-offline
  
  do-lint:
    stage: lint
    script:
      - ./node_modules/.bin/eslint src
      - ./node_modules/.bin/stylelint &quot;src/*.{css,scss}&quot;
  
  test-front-end:
    stage: test
    script:
      # Force tests to run in CI mode
      - CI=true npm test
    coverage: '/^All\sfiles.*?\s+\d+.\d+.*?\s+(\d+.\d+)/'
  
  do-build:
    stage: build
    script:
      - npm run build
  </code></pre>
  <p>Would very much appreciate some assistance!</p>