Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get yarn install to fix errors yarn check finds

Tags:

yarnpkg

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.

like image 654
shaunc Avatar asked Jan 28 '17 19:01

shaunc


People also ask

How do I fix a yarn install error?

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.

What does yarn install -- check files do?

yarn install --check-filesVerifies that already installed files in node_modules did not get removed.

What is yarn check?

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.

Does yarn automatically install dependencies?

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.


1 Answers

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.

like image 74
Franklin Qin Avatar answered Oct 24 '22 05:10

Franklin Qin