If yarn check
finds a discrepancy, how do I get yarn install
to fix it?
Background: I have yarn.lock and package.json checked in; when I install a new package, it works locally, but then when I install to a different NODE_MODULES target, yarn install
doesn't seem to notice that the new dependency needs to be added, but yarn check
sees it.
Indeed, I read that yarn install
does the same check as yarn check --integrity
, and the later command does not see the discrepancy (ie functions just like yarn install
). The question is how to get yarn install
to perform the same check as yarn check
or otherwise get yarn install
to notice what yarn check
has (or would have) found.
To solve the error "yarn: command not found", install the yarn package globally by running npm install -g yarn and restart your terminal. If the command fails, run it with sudo and make sure the correct PATH is set in your system's environment variable.
yarn install --check-filesVerifies that already installed files in node_modules did not get removed.
yarn check --integrityVerifies that versions and hashed values of the package contents in the project's package. json match those in yarn's lock file. This helps to verify that the package dependencies have not been altered.
If you have just checked out a package from version control, you will need to install those dependencies. If you are adding dependencies for your project, then those dependencies are automatically installed during that process.
Note that from yarn check documentation it says:
The command yarn check has been historically buggy and undermaintained and, as such, has been deprecated and will be removed in Yarn 2.0. You should use
yarn install --check-files
instead.
For me, I usually just yarn upgrade --latest
to upgrade dependencies to latest versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With