learn-co-curriculum / omniauth_lab

Other
1 stars 349 forks source link

Please update the Gemfile.lock file, and use the Thin gem instead of Puma #17

Open Sdcrouse opened 4 years ago

Sdcrouse commented 4 years ago

TL;DR version: Unless this is a local environment-specific issue, I would suggest updating the Gemfile.lock file and using the Thin gem instead of Puma. If replacing Puma with Thin is a hassle, then the Readme should instruct students to go to http://localhost:3000. The reason for this is that I had to delete the Gemfile.lock and run bundle install just to get rails s working. Then, because Puma was used instead of Thin, I had to navigate to http://localhost:3000 instead of https://localhost:3000. The other labs up to this point have used Thin and HTTPS. Update: I also had to install the learn-co gem to get the learn command working after that, but that may just be a local environment issue.

The long version:

I need to start by saying that I am using a WSL/Ubuntu/VSCode local environment, and my Rails version is 5.2.4.1. My Ruby version is 2.6.3p62.

When I got to the part of the Readme that says "Start your web server and visit the root route", I ran rails s and got this output:

Command 'rails' not found, but can be installed with:

sudo apt install ruby-railties

However, the railties gem was already in the Gemfile. I was instructed by a technical coach to run bundle install. That got this output (not including the Traceback):

Could not find 'bundler' (2.0.1) 
required by your [...] Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.0.1`

I then ran bundle update --bundler and got this output:

You must use Bundler 2 or greater with this lockfile

I finally managed to resolve this issue by deleting the Gemfile.lock file and running bundle install. I could then run rails s without getting any errors.

That having been said, in previous labs, this was the output of rails s:

=> Booting Thin
=> Rails 5.0.7.2 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop

I would then navigate to https://localhost:3000, and everything would work just fine.

However, this lab uses Puma instead of Thin, so this is the output I get when I run rails s:

=> Booting Puma
=> Rails 5.2.4.1 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.2 (ruby 2.6.3-p62), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop

The problem is that now, https://localhost:3000 doesn't work; instead the page shows this: image

I tried clearing my browser cache, but I don't think that helped. Neither did tcp://localhost:3000 (that just redirected me to a Google search).

Here's what DID work: navigating to http://localhost:3000 instead of https://localhost:3000.

So, here's my suggestion: The Gemfile.lock file needs to be updated so that rails s will work. Also, it might be better to use the Thin gem instead of Puma, so that students can navigate to https://localhost:3000. Either that, or have the Readme instruct students to use http://localhost:3000 instead.

Update: After all that, the learn and learn submit commands didn't work. Instead, they returned this error: learn: command not found. I was able to fix this by running gem install learn-co. I don't know if other students will encounter this problem; it may be an issue with my local environment.

Thanks a lot for looking into this! This was a tricky issue to solve.

--- Sdcrouse

ryanmeinzer commented 4 years ago

Thanks so much for the thorough overview! I had the exact issues you had and if it weren't for your thorough overview, I would've struggled much longer to resolve. Thanks again. I agree with all of your suggestions.

Only addition I'd have would be that running gem pristine nokogiri --version 1.10.8 seemed to resolve my additional error of "Could not find nokogiri-1.10.9 in any of the sources" when trying to run rails s. Once completing this, I was able to run Puma.

Sdcrouse commented 4 years ago

You're welcome! Glad this helped.

I don't think I ran into that Nokogiri error, but it's been a while since I did this lab. Great job figuring out how to fix it; that may help other students, too!