ga-wdi-exercises / project2

[project]
1 stars 30 forks source link

Issue with Devise #871

Closed aeaghannam closed 7 years ago

aeaghannam commented 7 years ago

Hi all,

I'm having issues with install 'Devise' in my rails app in order to create user authentication log-ins:

When I attempt to follow our last lesson plan on the matter and I attempt to do the following in the terminal (while directed in my app directory):

In order to use Devise, we must include it in our Gemfile... gem "devise" $ bundle install $ rails g devise:install

I end up getting the following error message in the terminal: Running via Spring preloader in process 82152 Could not find generator 'devise:install_'. Maybe you meant 'test_unit:job', 'assets' or 'generator' Run rails generate --help for more options.

snip20170430_8

juancgarcia commented 7 years ago

Commit and push to your repo, and then comment here with a link to your Gemfile

aeaghannam commented 7 years ago

Thanks Juan, it actually looks like I have the devise gem already installed. According to the 'gem list' command I have "devise (4.2.1)" installed yet still have issues this. I also am having issues with pushing my app to GitHub...I'll have to check in during the next open office hours today.

AndyWhitley commented 7 years ago

Hi @aeaghannam, did you get help from John yet about this problem?

aeaghannam commented 7 years ago

@AWhitleyGA yup, John helped me out. It looks like I didn't manually add the devise gem in my gem file, my previous 'gem list' command was just displaying that I had the gem somewhere in my computer but not necessarily in the gem file in question. thanks!

aeaghannam commented 7 years ago

ok guys, now it seems like I have another issue with this...

I added gem "devise" to my gem file (see screenshot) and installed '$ bundle install', but when I attempt '$ rails g devise:install' I get the following error:

$ rails g devise:install /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in rescue in block (2 levels) in require': There was an error while trying to load the gem 'devise'. Gem Load Error is: undefined methodalias_method_chain' for ActionDispatch::Routing::RouteSet:Class Did you mean? alias_method Backtrace for gem load error is: /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:14:in <class:RouteSet>' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:2:in' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:1:in <top (required)>' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:inrequire' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in block in require' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:inload_dependency' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/devise-1.5.4/lib/devise/rails.rb:1:in<top (required)>' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:inblock in require' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in load_dependency' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:inrequire' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/devise-1.5.4/lib/devise.rb:445:in <top (required)>' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:inrequire' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in block (2 levels) in require' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:ineach' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in block in require' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:ineach' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in require' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler.rb:106:inrequire' /Users/abrahimelias/Code101/config/application.rb:7:in <top (required)>' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:82:inrequire' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:82:in preload' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:143:inserve' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:131:in block in run' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:125:inloop' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:125:in run' /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in<top (required)>' /Users/abrahimelias/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' /Users/abrahimelias/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire' -e:1:in <main>' Bundler Error Backtrace: (Bundler::GemRequireError) from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:90:inblock (2 levels) in require' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in each' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:inblock in require' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in each' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:inrequire' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler.rb:106:in require' from /Users/abrahimelias/Code101/config/application.rb:7:in<top (required)>' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:82:in require' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:82:inpreload' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:143:in serve' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:131:inblock in run' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:125:in loop' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:125:inrun' from /Users/abrahimelias/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in <top (required)>' from /Users/abrahimelias/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from /Users/abrahimelias/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' from -e:1:in

'

snip20170501_9

AndyWhitley commented 7 years ago

Interesting. Make sure that you see devise listed in the Gemfile.lock. If you do, please commit and push your current code to GitHub so I can clone it down and test it out.

AndyWhitley commented 7 years ago

Also, make sure you saved your Gemfile and ran bundle install after saving.

aeaghannam commented 7 years ago

I was able to run bundle install and "Using devise 1.5.4" is listed, but still having issues with the next step...I also can't seem to push this to Githib :/

AndyWhitley commented 7 years ago

What error are you getting when you try to push?

aeaghannam commented 7 years ago

$ git push origin master fatal: 'origin' does not appear to be a git reposi snip20170501_10 tory fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

aeaghannam commented 7 years ago

I think @jsm13 may have mentioned some sort of access key issue is present on my Github account last week, not sure if that is causing this issue here

aeaghannam commented 7 years ago

These are the access keys I currently have, not sure if this is an issue... snip20170501_11

AndyWhitley commented 7 years ago

Maybe, show me what you get back when you run git remote -v

aeaghannam commented 7 years ago

hmm nothing seems to happen ... snip20170501_1

AndyWhitley commented 7 years ago

So you need to first set up a repository on GitHub with a name matching your local one (Code101), add it as a remote, and then push:

aeaghannam commented 7 years ago

@AWhitleyGA ok so I was able to do all the steps above Andy, yet I have this issue when I try to push my code up.... snip20170501_3

juancgarcia commented 7 years ago

I think your ssh keys for github might not be loaded.

In your terminal, run this command:

ssh-add -l -E md5

Output should look something like this:

4096 MD5:f2:f7:1a:4a:14:48:10:19:2b:92:91:b4:1f:9b:d1:23 your_username@email_server.com (RSA)

Your fingerprint (the part after MD5:) should match with one of the keys on your github settings: https://github.com/settings/keys.

Let me know what output you get and whether or not it matches whats in your settings page.

aeaghannam commented 7 years ago

@juancgarcia this is the message I get when I run the command you specified: $ ssh-add -l -E md5 The agent has no identities.

aeaghannam commented 7 years ago

these are my current key settings ... snip20170501_4

aeaghannam commented 7 years ago

Do you think I should delete my Windows Key that I set up for my PC a few weeks ago?

juancgarcia commented 7 years ago

Additional keys aren't a problem. What github needs is a match between the public key you've given them, and the private key you hold.

Since the command had no output, then you need to load your key again. run ls on your ssh folder:

ls -la ~/.ssh/

You hopefully only have a few files here. Each key should come in pairs (private has no extension, and the public has the same name with .pub at the end) like id_rsa and id_rsa.pub.

Starting with the newest private key file, run this command and find the key which matches a fingerprint on github:

ssh-keygen -E md5 -lf ~/.ssh/my_key_rsa

(replace my_key_rsa with the filename you're testing)

Once you've found the right key, run the following (again replacing my_key_rsa with your filename)

eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/my_key_rsa

That should get your key loaded

aeaghannam commented 7 years ago

ok @juancgarcia , so I followed your steps above until I got to "finding the right key" - the following results don't match any of the keys I have listed on my profile ... snip20170501_5

aeaghannam commented 7 years ago

my keys.... snip20170501_4

juancgarcia commented 7 years ago

Try it with the github_rsa file.

aeaghannam commented 7 years ago

Hi Juan so that file above worked (in green)...but when I got to the last step you mentioned (in red) my password didn't work. I updated my password and tried that to confirm I was using the correct one, yet still the same issue: snip20170501_6

aeaghannam commented 7 years ago

I'll continue working on other elements of my app and check-in to the next office hours tmrw, if that's easier

jsm13 commented 7 years ago

that passphrase will be different than the machine's default password. If you set that up in class we recommended leaving it blank. If that doesn't work, I'd recommend setting up new keys following the steps here

juancgarcia commented 7 years ago

@aeaghannam If John's suggestion got you up and running, go ahead and close this issue.