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

Posted . Visible to the public.

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.

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.

Judith Roth
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Judith Roth to makandra dev (2019-06-17 13:05)