Read more

Yarn: How to recognize that you are using a different node version than your colleagues

Judith Roth
June 17, 2019Software engineer at makandra GmbH

The issue in this card can occur if the node_modules directory is checked into your Git repository. We usually recommend to exclude node_modules from version control.

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

In any case you should document which version of node to use in your project in a .nvmrc file.


I saw a strange behaviour after we introduced webpack in one of our projects and finally found out the reason: The person who committed the files used a node version that is older than mine.

Every time I wanted to run my rails dev server I was asked to check my yarn integrity:

error Integrity check failed                                                   
error Found 1 errors.                                                          


========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================


To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).


yarn check v1.16.0
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.


Exiting

After doing exactly that with yarn install --check-files I had file changes in node_modules/.yarn-integrity:

 {
-  "systemParams": "linux-x64-57",
+  "systemParams": "linux-x64-64",
   "modulesFolders": [
     "node_modules"
   ],
-  "flags": [],
+  "flags": [
+    "checkFiles"
+  ],
   "linkedModules": [],
   "topLevelPatterns": [
     "@rails/webpacker@4.x",

There were also changes in node_modules/node-sass/vendor/linux-x64-64/binding.node.

After I switched to the "correct" version of node the problems were gone.

Posted by Judith Roth to makandra dev (2019-06-17 15:05)