Ruby Ruby on Rails 5 Basics Creating an App Creating a Rails App

Jason Woo
Jason Woo
11,730 Points

bin/rails server error

bin/rails server

/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /mnt/c/Users/User/Documents/teamtreehouse/blog/config/boot.rb:3:in `<top (required)>'
        from bin/rails:3:in `require_relative'
        from bin/rails:3:in `<main>'

How do I fix this?

6 Answers

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

I notice that, according to Ruby, your app seems to be stored in /mnt/c/Users/User/Documents/teamtreehouse/blog. This makes me think that you are running on Windows, but inside some alternate POSIX-compatible shell. Is this correct? Can you tell us more about your setup?

If you're on Windows, I would recommend setting up your Ruby/Rails environment following these directions. You can use a different setup, but you may find the directions listed on Treehouse don't always work correctly.

Jason Woo
Jason Woo
11,730 Points

I followed those instructions afterward and ran into a different error. Is there a way that I completely wipe ruby and rails related programs and start again?

Jay McGavren
Jay McGavren
Treehouse Teacher

Can you copy/paste the error you got?

If you still want to uninstall/reinstall, I found some directions at https://stackoverflow.com/a/30466540 that may help:

Close all Command Prompt windows to avoid locks.

Close all Windows Explorer windows to avoid locks.

Control Panel > System > Environment Varables > remove any paths in the PATH environment variable that have installations of Ruby.

Control Panel > Programs and Features > Uninstall any Ruby Installer apps listed.

Delete the Windows folders where installed.

I still don't know what this other Ruby environment that you have installed is, and it's very possible the old installation is conflicting with the new one. Can you post the link where you downloaded it?

Jason Woo
Jason Woo
11,730 Points

I reinstalled everything, but with the newer versions of the recommended installations (this tutorial is a tad bit dated). So I installed ruby 2.4.2 x64 and the latest version of rails. After I typed 'rails new blog' I ran into this error.

      create
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/views/layouts/application.html.erb
      create  app/assets/images/.keep
      create  app/mailers/.keep
      create  app/models/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
         run  bundle install --local
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/vendor_ruby/rails/generators/app_base.rb:328:in `bundle_command'
        from /usr/lib/ruby/vendor_ruby/rails/generators/app_base.rb:344:in `run_bundle'
        from (eval):1:in `run_bundle'
        from /usr/lib/ruby/vendor_ruby/thor/command.rb:27:in `run'
        from /usr/lib/ruby/vendor_ruby/thor/invocation.rb:126:in `invoke_command'
        from /usr/lib/ruby/vendor_ruby/thor/invocation.rb:133:in `block in invoke_all'
        from /usr/lib/ruby/vendor_ruby/thor/invocation.rb:133:in `each'
        from /usr/lib/ruby/vendor_ruby/thor/invocation.rb:133:in `map'
        from /usr/lib/ruby/vendor_ruby/thor/invocation.rb:133:in `invoke_all'
        from /usr/lib/ruby/vendor_ruby/thor/group.rb:232:in `dispatch'
        from /usr/lib/ruby/vendor_ruby/thor/base.rb:440:in `start'
        from /usr/lib/ruby/vendor_ruby/rails/commands/application.rb:17:in `<top (required)>'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/vendor_ruby/rails/cli.rb:14:in `<top (required)>'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Jason Woo
Jason Woo
11,730 Points

After typing 'bin/rails server' into the command prompt, I get this error.

/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- bundler/setup (LoadError) from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from /mnt/c/Users/User/blog/config/boot.rb:3:in <top (required)>' from bin/rails:3:inrequire_relative' from bin/rails:3:in `<main>'

Jay McGavren
Jay McGavren
Treehouse Teacher

Jason Woo interesting - the paths in this latest output make it look like you're not on Windows any more, but on a Mac or Linux system. Before we continue, can you please give us the following information?

  1. The name and version of your operating system
  2. A link to the directions you followed when setting up Ruby and Rails
  3. A list of anything you did that differed from those directions

Thanks!

Jason Woo
Jason Woo
11,730 Points

I just did a fresh wipe on my computer so I can't give be too specific on some questions, but I'll try my best to answer them.

I downloaded bash from some other tutorial because I learn how to use it briefly on codeacademy.

1) Windows 10 & the version is not the most up to date. Can't tell you which version exactly, but I haven't updated it for quite some time.

2) I followed teamtreehouse ruby on rails windows download tutorial.

3) I download the latest versions of the recommended downloads as listed in my previous comment.

PS: I just downloaded railsinstaller.org 'Windows Ruby 2.3' package on another computer. Running the server works! Are there any drawbacks from doing it this way? Am I missing anything? The packages on railsinstaller seem to be more up to date than the video tutorial, but not the as up to date as the source websites themselves.

Also, how do I update the pacakages if I need to update them in the future?

Thanks a lot for your help Jay!

Jay McGavren
Jay McGavren
Treehouse Teacher

So, you followed this tutorial, correct?

The chief problem with using RailsInstaller is that the commands from our tutorials may not work, as they haven't been tested with RailsInstaller. But if it's working for you, I'd say go ahead with it!

Also, how do I update the pacakages if I need to update them in the future?

I don't think you'll need to do that until well after you've completed all the Rails content on Treehouse. The basics of Rails don't change much from version to version. When you do need to, though, this guide may help.

Jason Woo
Jason Woo
11,730 Points

https://www.youtube.com/watch?v=pmXFRfi9rpQ

This is the tutorial I used to download bash on Windows.

Are there any advantages from using bash as opposed to the traditional windows Command prompt. Are there any drawbacks from using an incomplete/beta version of bash?

Jay McGavren
Jay McGavren
Treehouse Teacher

If you use Bash, you'll probably need to follow the Mac/Linux versions of the commands that are given, NOT the Windows versions. But actually I will be surprised if the commands from our tutorials work at all. Setting up Ruby and Rails on Windows is tricky (as you are discovering), and using Bash within windows only adds another layer of complexity. We also have not tested these tutorials within Bash on Windows; we've only tested them within the "Command Prompt".

Jason Woo
Jason Woo
11,730 Points

Update: Back on my main computer, now fully wiped, I downloaded Ubuntu on the windows store.

Update 2: I enter bash by opening Command Prompt and typing 'bash'. When I enter rails new blog from here I got this error.

-bash: /mnt/c/RailsInstaller/Ruby2.3.3/bin/rails: ruby: bad interpreter: No such file or directory

I then typed the same thing after exiting bash and everything worked beautifully. So I guess this means that either the way I'm entering bash or just ubuntu itself on windows is unreliable?

I know that using bash is standard practice in web development? How should I proceed?

Update 3: After typing ruby bin\rails server this is what I'm getting.

=> Booting Puma
=> Rails 5.1.4 application starting in development
=> Run `rails server -h` for more startup options
*** SIGUSR2 not implemented, signal based restart unavailable!
*** SIGUSR1 not implemented, signal based restart unavailable!
*** SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Version 3.11.0 (ruby 2.3.3-p222), codename: Love Song
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Jay McGavren
Jay McGavren
Treehouse Teacher

I'm not really familiar with how Ubuntu can be installed from the Windows Store. I would definitely not recommend using that method to follow our tutorials, as it seems likely you'll run into incompatibilities. Exiting bash and running via an ordinary Command Prompt is definitely the recommended method.