Cache - package.json checksum changing after npm install



I’m using CircleCi 2.0 on a repository containing multiple “package.json”, checksums of some of them are changing after install

Here is my folder tree:


I’m using the following docker image: circleci/node

I’m trying to avoid installing packages between builds when package.json does not change with the following jobs:

  - restore_cache:
      key: ee-root-{{ checksum "package.json"}}

  - restore_cache:
      key: ee-client-{{ checksum "./client/package.json"}}

  - restore_cache:
      key: ee-server-{{ checksum "./server/package.json"}}

  - run:
      name: install
      command: npm install

  - save_cache:
      key: ee-root-{{ checksum "package.json"}}
        - ./node_modules

  - save_cache:
      key: ee-client-{{ checksum "./client/package.json"}}
        - ./client/node_modules

  - save_cache:
      key: ee-server-{{ checksum "./server/package.json"}}
        - ./server/node_modules

install task does the following:
npm install in sub folders (client and server) is triggered with a postinstall task (this step is running just fine)

"postinstall": "npm-run-all --sequential install:back install:front",
"install:back": "cd server && npm install",
"install:front": "cd client && npm install --no-optional",

The checksums of my 1st and 3rd keys differs between restore and save.
The 2nd one (ee-client-{{ checksum “./client/package.json”}}) is fine though (the one using --no-optional option during install) …

Restore steps (in order):

  1. No cache is found for key: ee-root-DHqIL86OMa531B6sAUr6+bgxVExVQ1mL7DUWqohmzf0=
  2. Found a cache from build 702 at ee-client-V2riR5JNpktQayUzMMeBEEYNKiqV7r5Xy4qPJnuqOXM=
  3. No cache is found for key: ee-server-YYeI+qBnI57wemjkeuWIjhEawh+nqTiuTB9pj8i80Jw=

Save cache steps (in order):

  1. Skipping cache generation, cache already exists for key: ee-root-d98FEmV8naG4N9DkcguEeC0FOjpTIZNH5FAFzrfFCPg=
  2. Skipping cache generation, cache already exists for key: ee-client-V2riR5JNpktQayUzMMeBEEYNKiqV7r5Xy4qPJnuqOXM=
  3. Skipping cache generation, cache already exists for key: ee-server-aoj_r_aXxwJgZZnhao2C+W+Pi31dm+84YPwLWg9QgI0=

Build address:

Thanks for your time.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.