Skip to content

Run yarn check --verify-tree as part of the yarn integrity check #1774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2018

Conversation

afcapel
Copy link
Contributor

@afcapel afcapel commented Oct 24, 2018

I've found an issue in an application in which some packages where missing from node_modules but webpacker didn't give any warning message.

Steps to reproduce:

  • remove some packages from node_modules
  • restart the rails server

Expected behaviour:

I see a message: Your Yarn packages are out of date!

Actual behaviour:

The app runs as usual and the compilation process fails.

Fix

It turns out yarn check --integrity doesn't actually checks the whole integrity of node_modules. From the yarn documentation:

yarn check --integrity checks that versions and hashed
values of the package contents in the project’s package.json
match those in yarn’s lock file.

We need both yarn check --integrity and yarn check --verify-tree:

yarn check --verify-tree Recursively verifies that the dependencies in package.json are present in node_modules and have the right version. This check does not consider yarn.lock.

Also it would be better to advise to run yarn install --check-files. Otherwise, missing files from node_modules will be ignored.

From the yarn documentation[1]:

`yarn check --integrity` checks that versions and hashed
values of the package contents in the project’s package.json
match those in yarn’s lock file.

That doesn't actually check that the packages are actually
installed in node_modules. To check that we need to run
`yarn check --verify-tree`

[1]: https://yarnpkg.com/lang/en/docs/cli/check/
@gauravtiwari gauravtiwari merged commit bb132d5 into rails:master Oct 26, 2018
@gauravtiwari
Copy link
Member

thanks :)

@jonleighton
Copy link
Member

FYI: this introduced a breakage for users with a non-standard node_modules location: #1884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants