3

$ rails 6.0.2 new sample_app2

    .
    .
    .
    Using web-console 4.0.1
    Using webdrivers 4.1.3
    Using webpacker 4.2.2
    Bundle complete! 17 Gemfile dependencies, 75 gems now installed.
    Use `bundle info [gemname]` to see where a bundled gem is installed.
             run  bundle binstubs bundler
    The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
    Skipped bundle since it already exists.
    If you want to overwrite skipped stubs, use --force.
             run  bundle exec spring binstub --all
    * bin/rake: Spring inserted
    * bin/rails: Spring inserted
           rails  webpacker:install
    Traceback (most recent call last):
        4: from /home/emsawy/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `'
        3: from /home/emsawy/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
        2: from /home/emsawy/.rvm/gems/ruby-2.6.3/bin/yarn:23:in `'
        1: from /home/emsawy/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/bundler/rubygems_integration.rb:400:in `block in replace_bin_path'
    /home/emsawy/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/bundler/rubygems_integration.rb:372:in `block in replace_bin_path': can't find executable yarn for gem yarn. yarn is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
    Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/

Also after performing

 Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/ 

I got the same result

   

     $ yarn -v
     [DEPRECATION] The trollop gem has been renamed to optimist
     and will no longer be supported. Please switch to optimist
     as soon as possible. Yarn v0.1.1 2011 Jesper Kjeldgaard

    $ ruby -v
         ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

    $ rails -v
         Rails 6.0.2.1

4
  • Have you tried yarn install command ? Commented Dec 19, 2019 at 13:48
  • So did you install yarn? as it directed you to site: yarnpkg.com/lang/en/docs/install/#debian-stable Commented Dec 19, 2019 at 14:14
  • $ yarn install [DEPRECATION] The trollop gem has been renamed to optimist and will no longer be supported. Please switch to optimist as soon as possible. Commented Dec 19, 2019 at 14:24
  • yes I did but still gives me the same Commented Dec 19, 2019 at 14:25

2 Answers 2

3

You installed yarn as a gem https://rubygems.org/gems/yarn and this is wrong. Now you should do:

  1. Uninstall this gem, gem uninstall yarn

  2. On mac os brew install yarn if other platform then look here: https://yarnpkg.com/lang/en/docs/install/#debian-stable

  3. Check version, should be something like:

yarn -v

1.21.1

Sign up to request clarification or add additional context in comments.

3 Comments

i performed these steps in user mode and got work well thanks :)
but what difference between yarn and gem yarn?
gem yarn is something completely different -Yarn is a multi-process webserver written in Ruby 1.9 by Jesper Kjeldgaard.. While yarn you need is a dependency manager.
0

Got the same error.

  1. First uninstall yarn by commanding gem uninstall yarn.

    It will ask yn, Enter yn

  2. Next run: command gem update

  3. Finally check yarn --version

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.