Skip to content
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

Railtie yarn check --integrity fails on development #1374

Closed
doits opened this issue Mar 23, 2018 · 64 comments
Closed

Railtie yarn check --integrity fails on development #1374

doits opened this issue Mar 23, 2018 · 64 comments

Comments

@doits
Copy link
Contributor

doits commented Mar 23, 2018

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.

@gauravtiwari
Copy link
Member

@doits When is this happening -running binstubs or rake tasks?

@doits
Copy link
Contributor Author

doits commented Mar 23, 2018

It happened to me when trying to upgrade the binstubs

bundle exec rails webpacker:binstubs

@keyranova
Copy link

keyranova commented Mar 23, 2018

This is happening to me on a fresh install:

created a new app (this step seemed to work fine):

rails new install_test --webpack

created databases:

rails db:create

then tried starting server

rails server

output:

=> Booting Puma
=> Rails 5.1.5 application starting in development
=> Run `rails server -h` for more startup options


========================================
  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 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/kurt/Sites/install_test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.


Exiting

yarn-error.log trace

Trace: 
  Error: Found 1 errors.
      at MessageError.Error (native)
      at new MessageError (/usr/local/Cellar/yarn/1.5.1/libexec/lib/cli.js:186:110)
      at /usr/local/Cellar/yarn/1.5.1/libexec/lib/cli.js:59470:13
      at next (native)
      at step (/usr/local/Cellar/yarn/1.5.1/libexec/lib/cli.js:98:30)
      at /usr/local/Cellar/yarn/1.5.1/libexec/lib/cli.js:109:13

@joeybeninghove
Copy link

joeybeninghove commented Mar 23, 2018

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.

@deepj
Copy link
Contributor

deepj commented Mar 23, 2018

The same problem (rails webpacker:install). Downgrading to 3.3.1 resolved that.

@alopez25
Copy link

Hey @joeybeninghove I had the same issue when trying to use Active Storage with Rails 5.2rc2. I've done as suggested downgrading webpacker to 3.3.1. However, I'm getting "Could not find rake-12.3.1 in any of the sources" when trying to run my rails console. Executing bundle install doesn't solve it.
Did it happen to you?

@gauravtiwari
Copy link
Member

Thanks everyone, just made a PR

@guilleiguaran We added that production flag earlier on the yarn install task, which raises integrity error after running bundle exec rails assets:precompile in development. By default, yarn respects NODE_ENV so I am not sure if we should consider removing this flag or keep it to ensure deterministic behaviour.

It's a bit unintuitive though, consider this example:

screen shot 2018-03-24 at 13 58 05

First, when we ran assets:precompile it executed fine but then it installed deps with production flag (using rake yarn install task), which changed the integrity and when we ran rails server again it threw integrity error.

What do you think?

@gauravtiwari
Copy link
Member

Just released 3.4.1 ^^

@afuno
Copy link

afuno commented Mar 25, 2018

@gauravtiwari Nope. Did not help. It appears when I want to create a model:

rails g model TestModel

Output:

========================================
  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).


env: node: No such file or directory

@gauravtiwari
Copy link
Member

@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: #1374 (comment)
so if you do assets:precompile make sure to run yarn again to re-install deps.

@puneetpandey
Copy link

puneetpandey commented Mar 27, 2018

I am facing the same issue. Can someone please suggest what am I doing wrong here!

Ruby 4.2.3
Rails 5.1.5
Webpacker 3.2.2
Hosted on: Elastic Beanstalk
yarn --version ~> 1.5.1
node --version ~> 6.13.1
RAILS_ENV ~> development

Output of /var/log/eb-commandprocessor.log

`/home/webapp` is not a directory.
Bundler will use `/tmp/bundler/home/webapp' as your home directory temporarily.
+ '[' false == true ']'
+ su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp
`/home/webapp` is not a directory.
Bundler will use `/tmp/bundler/home/webapp' as your home directory temporarily.


========================================
  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 Skipping preferred cache folder "/home/webapp/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-497".
error Couldn't find an integrity file
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 "/var/app/ondeck/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.

(Executor::NonZeroExitStatus)

[2018-03-26T12:37:38.806Z] ERROR [6562]  : Command CMD-SelfStartup failed!
[2018-03-26T12:37:38.806Z] INFO  [6562]  : Command processor returning results: 
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"(TRUNCATED)...nexpected error occurred: \"Found 1 errors.\".\ninfo If you think this is a bug, please open a bug report with the information provided in \"/var/app/ondeck/yarn-error.log\".\ninfo Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command. \nHook 
/opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh failed. For more detail, check 
/var/log/eb-activity.log using console or EB CLI","returncode":1,"events":[]}],"truncated":"true"}
[2018-03-26T12:37:38.807Z] ERROR [6562]  : exit (SystemExit)
at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/bin/command-processor:48:in `exit'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.11/bin/command-processor:48:in `<top (required)>'
from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `load'
from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `<main>'

Output of /var/app/ondeck/yarn-error.log

Trace: 
  Error: Found 1 errors.
    at MessageError.Error (native)
    at new MessageError (/usr/share/yarn/lib/cli.js:186:110)
    at /usr/share/yarn/lib/cli.js:59470:13
    at next (native)
    at step (/usr/share/yarn/lib/cli.js:98:30)
    at /usr/share/yarn/lib/cli.js:109:13

@gauravtiwari
Copy link
Member

@puneetpandey Have you run yarn install as suggested in the error? Does the error go away after that?

@puneetpandey
Copy link

@gauravtiwari tried running yarn install manually from /var/app/ondeck and it ran successfully.

ondeck]$ yarn install
yarn install v1.5.1
[1/4] Resolving packages...
success Already up-to-date.
Done in 26.86s.

@gauravtiwari
Copy link
Member

@puneetpandey Great 👍 everything is working now? You need to make sure NODE_ENV remains consistent. Also, don't use yarn install rake task in development since it installs deps in production mode by default, which causes integrity check to fail. Just use yarn or yarn install

@puneetpandey
Copy link

@gauravtiwari NODE_ENV was missing from my environment variables. Now added that and set it to development. I am now running eb deploy again to see, if I encounter any issue/s. Will keep posting here. Thanks for the help!

@dreyks
Copy link
Contributor

dreyks commented May 18, 2018

@gauravtiwari how can NODE_ENV be consistent if I'm running yarn install in dev but then (on CI or in production) yarn check --integrity is run in production and I get Flags don't match
nvm, just realized this feature is not meant to be enabled in test and production envs

@codingleo
Copy link

Same problem here using docker.

Starting myapp_db_1 ... done
Creating myapp_web_1 ... done
Attaching to gymintel_db_1, gymintel_web_1
db_1   | 2018-07-08 03:55:23.713 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2018-07-08 03:55:23.713 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2018-07-08 03:55:23.719 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2018-07-08 03:55:23.894 UTC [22] LOG:  database system was interrupted; last known up at 2018-07-08 03:27:33 UTC
db_1   | 2018-07-08 03:55:27.237 UTC [22] LOG:  database system was not properly shut down; automatic recovery in progress
db_1   | 2018-07-08 03:55:27.306 UTC [22] LOG:  invalid record length at 0/1633A70: wanted 24, got 0
db_1   | 2018-07-08 03:55:27.306 UTC [22] LOG:  redo is not required
db_1   | 2018-07-08 03:55:27.548 UTC [1] LOG:  database system is ready to accept connections
web_1  | => Booting Puma
web_1  | => Rails 5.2.0 application starting in development
web_1  | => Run `rails server -h` for more startup options
web_1  |
web_1  |
web_1  | ========================================
web_1  |   Your Yarn packages are out of date!
web_1  |   Please run `yarn install` to update.
web_1  | ========================================
web_1  |
web_1  |
web_1  | To disable this check, please add `config.webpacker.check_yarn_integrity = false`
web_1  | to your Rails development config file (config/environments/development.rb).
web_1  |
web_1  |
web_1  | yarn check v1.7.0
web_1  | error Couldn't find an integrity file
web_1  | error Found 1 errors.
web_1  | info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
web_1  |
web_1  |
web_1  | Exiting
myapp_web_1 exited with code 1

My dockerfile:

FROM ruby:2.5.1
ADD https://dl.yarnpkg.com/debian/pubkey.gpg /tmp/yarn-pubkey.gpg
RUN apt-key add /tmp/yarn-pubkey.gpg && rm /tmp/yarn-pubkey.gpg
RUN echo 'deb http://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -qq -y --no-install-recommends build-essential libpq-dev curl
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get update && apt-get install -qq -y --no-install-recommends nodejs yarn
RUN mkdir /myapp
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
RUN yarn install
COPY . /myapp

@kapso
Copy link

kapso commented Jul 10, 2018

Getting the same issue. Followed these upgrade instructions -https://github.com/rails/webpacker#upgrading

$ node --version
v8.11.3

$ yarn --version
1.7.0

$ yarn install
yarn install v1.7.0
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.54s.

$ yarn check --integrity
yarn check v1.7.0
success Folder in sync.
✨  Done in 0.10s.

$ rails --version
Rails 5.2.0

$ ruby --version
ruby 2.5.1p57

Issue:

$ rails c

========================================
  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.7.0
warning Integrity check: System parameters don't match
error Integrity check failed
error Found 1 errors.
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.

@bary822
Copy link

bary822 commented Jul 24, 2018

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.

@mirageglobe
Copy link

mirageglobe commented Nov 9, 2018

couple of things about docker installation, which sort of works. try

  • to run yarn install after copying your folder. yarn needs a few files in your app to run
  • make sure nodejs is a newer copy. default node installations do not have npm. you can use :

RUN curl -sL https://deb.nodesource.com/setup_11.x | bash
RUN apt-get install -qq -y nodejs

  • installing yarn using npm:

RUN npm install -g yarn

@kulte
Copy link

kulte commented Jan 25, 2019

Why was this issue closed? What is the solution? What's happening that causes this?

@AlphonseSantoro
Copy link

AlphonseSantoro commented Jan 31, 2019

Why was this issue closed? What is the solution? What's happening that causes this?

@kulte I found that running sudo yarn install works.
Thanks to: https://stackoverflow.com/questions/50078826/rubymine-and-yarn

@worldofprasanna
Copy link

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.

@Mirv
Copy link

Mirv commented Mar 11, 2019

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 ...

mirv:~/workspace $ yarn --verify-tree
yarn install v1.13.0
[1/4] Resolving packages...
[2/4] Fetching packages...
error @rails/webpacker@4.0.2: The engine "node" is incompatible with this module. Expected version ">=6.14.4". Got "6.11.2"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

jfly added a commit to jfly/worldcubeassociation.org that referenced this issue Mar 13, 2019
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 mode (see
rails/webpacker#1374 (comment)):

```
$ NODE_ENV=production bin/yarn check --integrity
yarn check v1.15.0
warning package.json: No license field
warning No license field
warning Integrity check: Flags don't match
error Integrity check failed
error Found 1 errors.
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
```

Changing `webpack:analyze` to set `RACK_ENV=test` lets us skip
running `bin/yarn check --integrity`. Ideally we'd probably set
`RACK_ENV=production`, but that gets tricky because there are lots of
secrets you need to get past ENVied's checks on startup.
@amingilani
Copy link

amingilani commented Oct 7, 2019

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:

# Copy the Gemfile as well as the Gemfile.lock and install
# the RubyGems. This is a separate step so the dependencies
# will be cached unless changes to one of those two files
# are made.
COPY Gemfile Gemfile.lock package.json yarn.lock ./
RUN bundle install --verbose --jobs 20 --retry 5 && \
    yarn install --check-files

# Copy the main application.
COPY . ./

# precompile assets
RUN bundle exec rake assets:precompile

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:

node_modules

You're welcome.

@coll-arty
Copy link

For me restarting spring fixed it: spring stop

It gets the job done, but the issue keeps reappearing again and again anyway

@dv-ms
Copy link

dv-ms commented Oct 14, 2019

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.

I had a yarn.lock file in the root directory of my rails app. Deleting that solved my issue!

@nezirz
Copy link

nezirz commented Oct 26, 2019

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.

@friflex
Copy link

friflex commented Oct 26, 2019

rm yarn.lock && sudo yarn install solved the problem for me

@zachbugay
Copy link

zachbugay commented Oct 30, 2019

I am running into the exact same issue too. I can't get around it using docker. I did update my webpacker.yml config setting check_yarn_integrity: false but I don't like that solution.

Suggestions? Ideas?

I have a .dockerignore file ignoring these:

  • .dockerignore
  • Dockerfile
  • node_modules

Here is my Dockerfile

FROM ruby:2.6.5-alpine

RUN apk update && apk add --no-cache \
    bash \
    build-base \
    nodejs \
    yarn \
    sqlite-dev \
    tzdata

# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY package.json /usr/src/app/package.json
COPY yarn.lock /usr/src/app/yarn.lock
RUN yarn install --check-files

RUN gem install bundler
COPY Gemfile Gemfile.lock /usr/src/app/
RUN bundle install --binstubs

COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh

COPY . /usr/src/app

CMD ["/usr/src/app/entrypoint.sh"]

@thisismydesign
Copy link

Got the same thing with a fresh Docker build.

Dockerfile

FROM ruby:2.6.5-alpine

RUN apk add --no-cache \
      nodejs \
      build-base \
      postgresql-dev \
      tzdata \
      yarn

docker-compose.yml

command: 'sh -c "bin/rails db:create db:migrate && bin/rails server --port 3001 --binding 0.0.0.0"'

Adding yarn install to the command reolved it, but this is definitely not nice:

command: 'sh -c "yarn install && bin/rails db:create db:migrate && bin/rails server --port 3001 --binding 0.0.0.0"'

@TorvaldsDB
Copy link

For me restarting spring fixed it: spring stop

Thank you very much. You help me too much. AH. My mac was almost broken by me. You saved it.

@cooperka
Copy link

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.

  1. nvm use to use the version defined in .nvmrc
  2. yarn install --check-files with the correct Node version
  3. nvm use in any other shell you want to run commands in
  4. Now the integrity checks will pass

@mainangethe
Copy link

@gauravtiwari Nope. Did not help. It appears when I want to create a model:

rails g model TestModel

Output:

========================================
  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).


env: node: No such file or directory

This is what worked for me. I was "dockering" a rails 6 app

@alexey
Copy link

alexey commented Mar 3, 2020

I use nvm, so first time(after the boot) i cd'ed to project and tried to run rails s - its failed with same error, after switch to proper node nvm use 8.0.0I had to do spring stop -
Thenrails s worked under environment of 8.0.0

@jakeNiemiec
Copy link
Member

jakeNiemiec commented Mar 3, 2020

If you can, use node 10 or 12. Node 8 is End of Life:
image

its failed with same error, after switch to proper node nvm use 8.0.0

If you do need to use 8, make sure you set the default and at least use the latest version by excluding those explicit zeros. eg:

nvm install 8
nvm alias default 8
nvm use 8

That could even address other comments in this issue: https://stackoverflow.com/a/24587177/6091685

@scottwillson
Copy link

scottwillson commented Mar 29, 2020

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:

  • Rails' spring preloader. spring stop
  • node_modules rm -rf node_modules
  • yarn.lock rm yarn.lock
  • Rails server. Ctrl-C rails s

yarn install --check-files 🤞

@tasawar-hussain
Copy link

yarn --update-checksums worked for me!

lidimayra added a commit to lidimayra/url-shortener that referenced this issue May 23, 2020
Add node_modules to dockerignore to ensure that local dependencies won't
overwrite yarn installed dependencies

Ref:
rails/webpacker#1374 (comment)
lidimayra added a commit to lidimayra/url-shortener that referenced this issue May 23, 2020
Add node_modules to dockerignore to ensure that local dependencies won't
overwrite yarn installed dependencies

Ref:
rails/webpacker#1374 (comment)
@SeanJManning
Copy link

spring stop worked here as well

@sontd-0882
Copy link

I'm using nvm to control the version of node for projects, my projects don't have spring.

I try a lot of solution above, for examples:

yarn --update-checksums
yarn install --check-files
yarn install
rm -rf node_module && yarn install

But it doesn't work

This is how I solved the problem:

rm -rf yarn.lock
yarn install

@AlphonseSantoro
Copy link

AlphonseSantoro commented Jul 26, 2020

Why was this issue closed? What is the solution? What's happening that causes this?

@kulte I found that running sudo yarn install works.
Thanks to: https://stackoverflow.com/questions/50078826/rubymine-and-yarn

Update on my issue. I had installed yarn first from apt-get, and then installed nvm. This resulted in webpacker not using the nvm version. sudo yarn install did work, but I had to run it basically every time I changed project or ran tests etc. Uninstalling yarn and keeping nvm solved this for me entirely. Hope this helps some people :)

@rajeetrautela
Copy link

please 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

@risanto
Copy link

risanto commented Nov 26, 2020

I have the same issue and I solved this by uninstalling yarn 2 and reverting back to yarn 1

levady added a commit to levady/uss-poc that referenced this issue Dec 8, 2020
@RaminMammadzada
Copy link

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.

Thank you @bary822 , restarting the terminal also helped me.

@dombarnes
Copy link

I've had this happen quote a bit in a docker environment where I had node_modules in docker volume. For me the solution was to delete node_modules docker volume. Sharing for info.

@pdfrod
Copy link

pdfrod commented Feb 3, 2021

I believe Webpacker is using the yarn check command for this, but according to Yarn documentation this command is buggy and was removed in Yarn 2. So I think the proper fix would be to stop using this command (and maybe use yarn install --check-files instead?).

@aesyondu
Copy link

aesyondu commented Jun 3, 2021

In my case I had to downgrade from node version 15.8.0 to 14.16.0.

Error Log
yarn install v1.22.10
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
[4/4] 🔨  Building fresh packages...
[1/3] ⢀ fsevents
[-/3] ⢀ waiting...
error /Users/USER/projects/group/PROJECTNAME/src/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /Users/USER/projects/group/PROJECTNAME/src/node_modules/node-sass
Output:
Building: /Users/USER/.asdf/installs/nodejs/15.8.0/bin/node /Users/USER/projects/group/PROJECT_NAME/src/node_modules
/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=

@jasonfb
Copy link
Contributor

jasonfb commented Dec 18, 2021

@MarchandMD
Copy link

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.

I had a yarn.lock file in the root directory of my rails app. Deleting that solved my issue!

Not to be that guy... but where did that yarn.lock file come from? Because I sure has heck didn't place it there...

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

No branches or pull requests