webpacker: Railtie yarn check --integrity fails on development
just updated to 3.4.0 and I get this:
========================================
Your Yarn packages are out of date!
Please run `yarn install` to update.
========================================
To disable this check, please add `config.webpacker.check_yarn_integrity = false`
to your Rails development config file (config/environments/development.rb).
yarn check v1.5.1
warning package.json: No license field
warning No license field
warning Integrity check: Flags don't match
error Integrity check failed
error An unexpected error occurred: "Found 1 errors.".
info If you think this is a bug, please open a bug report with the information provided in "/Users/markus/svn/caseman-events/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
If I run it manually, everything is fine:
→ yarn check --integrity [demo/develop]
yarn check v1.5.1
warning package.json: No license field
warning No license field
success Folder in sync.
Done in 0.10s.
If I use NODE_ENV=production
I can reproduce it:
→ NODE_ENV=production yarn check --integrity [demo/develop]
yarn check v1.5.1
warning package.json: No license field
warning No license field
warning Integrity check: Flags don't match
error Integrity check failed
error An unexpected error occurred: "Found 1 errors.".
info If you think this is a bug, please open a bug report with the information provided in "/Users/markus/svn/caseman-events/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
If I install with production …
NODE_ENV=production yarn install
… I can use rails again and the rails integrity check works. But of course I want to use my development yarn packages, so this is no solution.
The problems seems to be that yarn check --integrity
is run with NODE_ENV=producion
, even locally when developing.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 16
- Comments: 64 (11 by maintainers)
Commits related to this issue
- Fix `webpack:analyze` after webpack(er) upgrade. The new version of webpacker has this `check_yarn_integrity` option which is enabled in dev. This check does *not* work if node is running in prod mod... — committed to jfly/worldcubeassociation.org by jfly 5 years ago
- Fix `webpack:analyze` after webpack(er) upgrade. The new version of webpacker has this `check_yarn_integrity` option which is enabled in dev. This check does *not* work if node is running in prod mod... — committed to thewca/worldcubeassociation.org by jfly 5 years ago
- Bumping Webpacker (and other deps) to resolve https://github.com/rails/webpacker/issues/1374 — committed to DFE-Digital/npd-find-and-explore by spikeheap 5 years ago
- Fix `webpack:analyze` after webpack(er) upgrade. The new version of webpacker has this `check_yarn_integrity` option which is enabled in dev. This check does *not* work if node is running in prod mod... — committed to Mjic99/worldcubeassociation.org by jfly 5 years ago
- Prevent overwriting on yarn installed dependencies Add node_modules to dockerignore to ensure that local dependencies won't overwrite yarn installed dependencies Ref: https://github.com/rails/webpac... — committed to lidimayra/url-shortener by lidimayra 4 years ago
- Prevent overwriting on yarn installed dependencies Add node_modules to dockerignore to ensure that local dependencies won't overwrite yarn installed dependencies Ref: https://github.com/rails/webpac... — committed to lidimayra/url-shortener by lidimayra 4 years ago
- comment out yarn integrity check see this issue for more details https://github.com/rails/webpacker/issues/1374 — committed to levady/uss-poc by levady 4 years ago
For me restarting spring fixed it:
spring stop
Why was this issue closed? What is the solution? What’s happening that causes this?
I had a yarn.lock file in the root directory of my rails app. Deleting that solved my issue!
i have solve
Getting the same issue. Followed these upgrade instructions -https://github.com/rails/webpacker#upgrading
Issue:
The deal is that many things need to be in sync on the same node.js version. They can be out of sync when you have a default node version, create a Rails project, and then switch to a different version, for example, via
nvm use
. I didn’t check every permutation, but node version can affect:spring stop
rm -rf node_modules
rm yarn.lock
rails s
yarn install --check-files
🤞@kulte I found that running
sudo yarn install
works.Thanks to: https://stackoverflow.com/questions/50078826/rubymine-and-yarn
spring stop
orDISABLE_SPRING=1 rails c
were the only solutions that worked for me (and it seems like several others). Why doesn’t spring play nicely with yarn here? Anybody have an idea what’s going on?For me it was:
Just dropping a note here to share my experience.
I’ve encountered the exact same issue. For my case, just restarting my terminal fixed the problem.
I had changed few configuration for NVM, which would have done something related.
Same problem here using docker.
My dockerfile:
rm yarn.lock && sudo yarn install
solved the problem for me@pawurb’s solution works for me!
Docker
I kept running into this issue while in Docker. The problem was that I was precompiling my app after I copied the entire app in. I.e., my
Dockerfile
contained the following:This essentially overwrote the dependencies yarn installed in Docker with the ones on my local computer, and hence the errors.
Solution
Add the
node_modules/
folder in your.dockerignore
file:You’re welcome.
@gauravtiwari Nope. Did not help. It appears when I want to create a model:
Output:
Running
sudo yarn install
also didn t work. It was giving the same error.After disabling the yarn integrity check (
config.webpacker.check_yarn_integrity = false
) it worked. But I don t think this is the proper solution.I encountered this when upgrading to v4.
None of the above solutions worked for me.
It turned out that even though I had disabled the integrity check in
config/webpacker.yml
, this was getting overridden by the earlier style of config inconfig/environments/development.rb
Seems that the canonical location for this config got moved from
development.rb
towebpacker.yml
, but that older installations of Webpacker might still have the old config.Removing the following two lines did the trick for me.
Try just
yarn install
This works for me
@puneetpandey Have you run
yarn install
as suggested in the error? Does the error go away after that?yarn --update-checksums
worked for me!couple of things about docker installation, which sort of works. try
This is happening to me on a fresh install:
created a new app (this step seemed to work fine):
created databases:
then tried starting server
output:
yarn-error.log trace
Same thing - rails 5.1 with ruby 2.5.3 … nvm installs vuejs fine, yarn seems to work till I go to start server up.
Sudo install yarn doesn’t work.
Closing / reopening terminal as well as shutting down complete - no fix.
yarn --verify-tree
was more helpful …@afuno Could you please run
yarn
just to make sure yarn is run in development mode and then create model?BTW, this is still an issue: https://github.com/rails/webpacker/issues/1374#issuecomment-375891562 so if you do
assets:precompile
make sure to run yarn again to re-install deps.I followed the @mirageglobe 's suggestion that using
npm install -g yarn
fixed my project.The same problem (
rails webpacker:install
). Downgrading to 3.3.1 resolved that.For anyone using
nvm
to manage Node versions, make sure you’re on the correct Node version before installing. This may apply to Docker as well if your image defaults a different version of Node than you used to install things originally.nvm use
to use the version defined in.nvmrc
yarn install --check-files
with the correct Node versionnvm use
in any other shell you want to run commands inplease check webpacker.yml i have found that i wrote check_yarn_integrity twice and one of the was true after removing that the issue get fixed
I’m using
nvm
to control the version of node for projects, my projects don’t havespring
.I try a lot of solution above, for examples:
But it doesn’t work
This is how I solved the problem:
spring stop
worked here as wellThank you very much. You help me too much. AH. My mac was almost broken by me. You saved it.
Deleting yarn.lock also fix the issue in my rails 6.0 project … had issue after upgraded system node from 10 to 12 -v
Update: Unfortunately deleting yarn.lock didnt fix the issue in total the message disappears but also I lost the sass on my site (styling was of because some js error). So I reverted the version of node in nvm from 12.0.0 to 10.xx and it worked okay.
I had this issue, but my real problem was
node-sass
failing to install connected to incompatability withnodejs 12
. I removed node and installednode 10.12
and the problem was solved.[ONLY for people using
nvm
lazy loading]Be sure to run
$ node -v
to trigger nvm to load before trying other solution.P.s. For me, forgetting to load nvm always results in this error, but sometimes even with nvm loaded the problem persists, that’s when I’ll do
$ spring stop
(proposed by @pawurb).Left: Failed because
node
is actually not available (I am usingNVM_LAZY_LOAD=true
from zsh-nvm)Right: Ensured
node
is available first and fixed.Did anyone find a fix for this? I am facing the same issue with JRuby-9.2.6.0 / Rails-5.0.7.2
Seems to work but doesn’t look like a good solution
@gauravtiwari
NODE_ENV
was missing from my environment variables. Now added that and set it todevelopment
. I am now runningeb deploy
again to see, if I encounter any issue/s. Will keep posting here. Thanks for the help!I’m running into the same thing with a new Rails 5.2 RC2 app. For me it happened when running
bundle exec active_storage:install
, but it sounds like there is something behind the scenes that multiple things are hitting causing this issue.Downgrading to 3.3.1 resolves the issue, FYI.