Explanation and best practise around yarn - warning Integrity check: System parameters don't match

Viewed 4240

When I was building and trying to run my docker image with a rubyonrails app, I was getting this error:

warning Integrity check: System parameters don't match 
error Integrity check failed 
error Found 1 errors.

I tried changing my Docker file with

RUN yarn install --check-files

But that didn't do anything.

I then just deleted the yarn.lock file and my container now runs.

I am guessing the issue is that rails was run locally on my laptop, and now it is trying to run the same yarn.lock file on another computer and the integrity check is failing? Is this correct?

What should my dockerfile be doing? Should I exclude the yarn.lock file from getting into my docker container in the first place?

3 Answers

First of all, you will need to remove the node_modules folder and run the yarn install again. In your command line, follow these instructions:

  1. Remove node_modules folder by typing rm -rf node_modules
  2. Run yarn install
  3. Run rails webpacker:install
  4. Restart your command-line editor.
  5. Be careful about the NodeJS version in your machine. It must be the same as the version in which the rails project was initialized. You can use nvm to manage the Node version.

Add "config.webpacker.check_yarn_integrity = false" in "development.rb" will solve the problem

I would suggest not copying yarn.lock in the container. You can add yarn.lock in the .dockerignore which Docker will ignore the yarn.lock while building the image.

I had faced similar issues because, locally I run on macOS and containers are alpine-based, so we end up ignoring the yarn.lock

Related