# Checksum different before and after bundle install

**URL:** <https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334>\
**Category:** Build Environment\
**Tags:** config, bundler\
**Created:** [October 12, 2017, 3:38pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334 "2017-10-12T15:38:54Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgpass](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rgpass/32/17215_2.png) [@rgpass](https://discuss.circleci.com/u/rgpass)\
**Post date:** [October 12, 2017, 3:38pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/1 "2017-10-12T15:38:54Z")

</div>

My CircleCI 2.0 `config.yml`:

```auto
version: 2
jobs:
  build:
    docker:
      - image: circleci/ruby:2.3.4
    working_directory: ~/repo
    steps:
      - checkout
      - run: echo "Running from .circleci/config.yml"
      - run: echo $CC_TEST_REPORTER_ID
      - run: ruby -v
      - run: gem install bundler -v 1.15.4
      - run: bundler -v
      - restore_cache:
          key: rails-{{ arch }}-{{ checksum "Gemfile.lock" }}
      - run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
      - save_cache:
          key: rails-{{ arch }}-{{ checksum "Gemfile.lock" }}
          paths:
            - vendor/bundle
      - run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
      - run: chmod +x ./cc-test-reporter
      - run: ./cc-test-reporter before-build
      - run: bundle exec rspec spec
      - run: ./cc-test-reporter after-build --exit-code $?

```

On the `restore_cache` step, it outputs:

> No cache is found for key: rails-arch1-linux-amd64-6\_62-2tqvY1YipbCiRdMsHC6hH0dE7Yy2rojGa7EQdF1a3QE=

On the `save_cache` step, it outputs:

> Skipping cache generation, cache already exists for key: rails-arch1-linux-amd64-6\_62-fpNAncficdF8R+0WmisGwNoy8Sv7EcxE\_xkzAEZUo0o=  
> Found one created at 2017-10-12 15:23:50 +0000 UTC

The `{{ checksum "Gemfile.lock" }}` is different before and after running the command `bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3`.

When run on my local machine, all it does is create a `vendor/bundle` directory, but does not alter the Gemfile. Is there something I can do to ensure that the `Gemfile.lock` checksum does not change?

---

<div class="post-metadata">

**Author:** ![lpaulmp](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/lpaulmp/32/2318_2.png) [@lpaulmp](https://discuss.circleci.com/u/lpaulmp)\
**Post date:** [November 15, 2017, 4:53pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/2 "2017-11-15T16:53:22Z")

</div>

I have the same issue but with Yarn, checksum gives me different checksums, this file never changes but gives me a different string:

```auto
version: 2  
jobs:                                                                              
  build:                                                                           
    working_directory: ~/app                                        
    docker:                                                                        
      - image: circleci/node:8.4                                                   
    steps:                                                                         
      - checkout                                                                   
      - restore_cache:                                                             
          key: dependency-cache-{{ checksum "yarn.lock" }}                         
      - run: npm install yarn                                                      
      - run: yarn install                                                                                                                                                    
      - save_cache:                                                                
          key: dependency-cache-{{ checksum "yarn.lock" }}                         
          paths:                                                                   
            - ~/app/node_modules                                    
            - ~/.cache           

```

---

<div class="post-metadata">

**Author:** ![rgpass](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rgpass/32/17215_2.png) [@rgpass](https://discuss.circleci.com/u/rgpass)\
**Post date:** [November 15, 2017, 5:58pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/3 "2017-11-15T17:58:37Z")

</div>

I haven’t resolved this issue yet. Worked through it with a few different folks with no luck.

---

<div class="post-metadata">

**Author:** ![borut-t](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/borut-t/32/12477_2.png) [@borut-t](https://discuss.circleci.com/u/borut-t)\
**Post date:** [January 16, 2018, 1:41pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/4 "2018-01-16T13:41:56Z")

</div>

Same issue here. I cannot figure out why. I’ve already send support ticket and am waiting for response.

---

<div class="post-metadata">

**Author:** ![colindresj](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/colindresj/32/17880_2.png) [@colindresj](https://discuss.circleci.com/u/colindresj)\
**Post date:** [February 22, 2018, 4:00pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/5 "2018-02-22T16:00:13Z")

</div>

Again, same issue here, but with package-lock.json

---

<div class="post-metadata">

**Author:** ![mzratio](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@mzratio](https://discuss.circleci.com/u/mzratio)\
**Post date:** [March 4, 2018, 4:17pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/6 "2018-03-04T16:17:42Z")

</div>

We have the same issue with npm and package.json

---

<div class="post-metadata">

**Author:** ![shawnbissell](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/shawnbissell/32/17901_2.png) [@shawnbissell](https://discuss.circleci.com/u/shawnbissell)\
**Post date:** [March 5, 2018, 9:09pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/7 "2018-03-05T21:09:13Z")

</div>

Same problem with package.json

---

<div class="post-metadata">

**Author:** ![RobinDaugherty](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/robindaugherty/32/1215_2.png) [@RobinDaugherty](https://discuss.circleci.com/u/RobinDaugherty)\
**Post date:** [March 10, 2018, 7:48pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/8 "2018-03-10T19:48:16Z")

</div>

Usually this is caused by a change made to `Gemfile` where `Gemfile.lock` wasn’t also committed. Make sure you run `bundle` and commit `Gemfile.lock`.

Also, there may be a different version of `bundler` on CircleCI as opposed to your development environment. You can install a specific version of Bundler on CircleCI if needed, but it’s probably best to update your development environment’s Bundler to the latest release. `gem install bundler`

---

<div class="post-metadata">

**Author:** ![thephred](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/thephred/32/11317_2.png) [@thephred](https://discuss.circleci.com/u/thephred)\
**Post date:** [March 13, 2018, 10:45pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/9 "2018-03-13T22:45:01Z")

</div>

I ran into this with `npm install`. TLDR: I didn’t have a new line at the end of my `package.json`.

I debugged this by rerunning a build with ssh and I ran a `git status` and noticed the `package.json` file did indeed have changes. Apparently, npm install will add a newline at the end of the file if there isn’t one.

For me, I had to add `"files.insertFinalNewline": true` to my `vscode` settings (because it was removing the newline ☹) and commit the file with a newline at the end.

---

<div class="post-metadata">

**Author:** ![shawnbissell](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/shawnbissell/32/17901_2.png) [@shawnbissell](https://discuss.circleci.com/u/shawnbissell)\
**Post date:** [March 22, 2018, 2:42am UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/10 "2018-03-22T02:42:35Z")

</div>

I solved my problem by using  
`npm i --no-save`  
The issue was caused by npm installing extra optional dependencies differently on different environments (fsevents from mac) that were committed in the npm–shrinkwrap.json.

---

<div class="post-metadata">

**Author:** ![PADomine](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/padomine/32/18446_2.png) [@PADomine](https://discuss.circleci.com/u/PADomine)\
**Post date:** [May 18, 2018, 6:34pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/11 "2018-05-18T18:34:05Z")

</div>

Exactly the same problem here. After doing:  
`cksum Gemfile.lock`  
`bundle update fastlane`  
`bundle check --path ../.bundle || bundle install --path ../.bundle`  
`cksum Gemfile.lock`

Before `bundle install`:  
`2779665191 3911 Gemfile.lock`

After:  
`710379616 3911 Gemfile.lock`

---

<div class="post-metadata">

**Author:** ![tom](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/tom/32/27680_2.png) [@tom](https://discuss.circleci.com/u/tom)\
**Post date:** [May 24, 2018, 7:59am UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/12 "2018-05-24T07:59:40Z")

</div>

Thanks for bringing this to our attention. We’ve added a Support Center article to help: [https://support.circleci.com/hc/en-us/articles/360004632473-No-Cache-Found-and-Skipping-Cache-Generation](https://support.circleci.com/hc/en-us/articles/360004632473-No-Cache-Found-and-Skipping-Cache-Generation)

---

<div class="post-metadata">

**Author:** ![rtymchyk](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rtymchyk/32/18071_2.png) [@rtymchyk](https://discuss.circleci.com/u/rtymchyk)\
**Post date:** [August 13, 2018, 9:32pm UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/13 "2018-08-13T21:32:03Z")

</div>

It does appear to be an issue with yarn overwriting the lock file. Make sure that if you are using `--frozen-lockfile` that your yarn version actually supports that.

---

<div class="post-metadata">

**Author:** ![arunkumarg](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/arunkumarg/32/19111_2.png) [@arunkumarg](https://discuss.circleci.com/u/arunkumarg)\
**Post date:** [September 15, 2018, 4:04am UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/14 "2018-09-15T04:04:05Z")

</div>

I have same problem in my project. Unfortunately Circle CI uses different bundler version, which resulted to modifying the Gemfile.lock and checksum failed.

I solved this by using “Gemfile” instead of “Gemfile.lock” and seems working.

```auto
    - restore_cache:
        keys:
        - wc-gems-v4-{{ .Branch }}-{{ checksum "Gemfile" }}
    - run:
        name: Bundle
        command: |
            export PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
            bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
            #command: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
    # Save dependency cache
    - save_cache:
        key: wc-gems-v4-{{ .Branch }}-{{ checksum "Gemfile" }}
        paths:
        - vendor/bundle
    

```

Seems to be working now.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [December 14, 2018, 4:16am UTC](https://discuss.circleci.com/t/checksum-different-before-and-after-bundle-install/17334/15 "2018-12-14T04:16:31Z")

</div>

Closed on December 14, 2018, 4:16am UTC

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