Forcing Yarn to check and install dependencies

Published on 2021-02-17 • Modified on 2021-02-17

It's something to know about Yarn. When running install (when a previous install has already be done), it doesn't check that every dependency is correctly installed. If you delete, rename something inside the node_modules folder by mistake, a standard yarn update can run without doing anything nor raising any warning. To force it to check all the files and folders, you have to use the --check-files option. If something is wrong, it will be fixed. You can also run the check alone by running: yarn check --integrity --verify-tree. Note that it won't work if a file is modified; it won't be restored to its original state. In this case, it's better to delete the whole dependency to reset it.

yarn install --check-files

 More on Stackoverflow   Read the doc  Random snippet