Devise Installation Not Working - devise

I am trying to install the devise gem but when i use the command
rails g devise:install
i get the error message :
Could not find generator 'devise:install'. Maybe you meant 'responders:install', 'simple_form:install' or 'scss:assets'
Run rails generate --help for more options.
can anyone assist me in rectifying this issue?

Try to to solve this by deleting my Gemfile.lock, doing bundle install again and then stopping spring with spring stop I could then call the generator without root privileges
OR
Try command:
sudo rails generate devise:install

This is mostly a typo if you copied it from the github repo.
I had a similar issue.
Make sure you added the gem in the gemfile as gem 'devise'
Run in your project directory: rails generate devise:install

Related

source ~/.rvm/source/rvm

Once in a while when working on my Rails app I try to use the Rails command and I get this error:
The program 'rails' can be found in the following packages:
* rails
* ruby-railties-3.2
Try: sudo apt-get install <selected package>
This happens over and over. I try gem install rails and it doesn't help. I have to first run source ~/.rvm/source/rvm and then gem install rails. But then after a short while the same thing starts happening.
I guess you missed to read instructions from installer and rvm commands, follow this simple instruction https://rvm.io/integration/gnome-terminal/ - it might be a bit different for your default terminal emulator.

Rails: Could not find bcrypt-ruby-3.0.1 in any of the sources

I read infinitely many stackoverflow articles on missing gems in ruby but I still fail in solving the problem. Here is the situation:
nicolamac:Proj a$ rails new MyGreatApp
[...]
nicolamac:Proj a$ cd MyGreatApp/
[...]
nicolamac:MyGreatApp a$ bundle install
[...]
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
But if I do:
nicolamac:MyGreatApp nicolagreco$ rails generate devise:install
I get
Could not find bcrypt-ruby-3.0.1 in any of the sources
How can I solve this problem?
Thanks
Try to install it by adding to your Gemfile:
gem "bcrypt-ruby"
an then run
bundle install

Omniauth + Devise Error: Could not find hashie-1.2.0

I add this to Gemfile:
gem 'omniauth-facebook'
Then I run bundle update. No problem so far. But when I run rails server I get this error:
Could not find hashie-1.2.0 in any of the sources
Run `bundle install` to install missing gems.
I thought that bundler was supposed to resolve and satisfy all dependencies, but I tried this anyway:
gem install hashie-1.2.0
Which gave this:
ERROR: Could not find a valid gem 'hashie-1.2.0' (>= 0) in any repository
ERROR: Possible alternatives: hashie-model
I'm new to Rails and I feel I'm at a dead end. Suggestions?
UPDATE: I also have run bundle install (to be exact bundle install --without production) several times. I get the same error when running rails server after that.
UPDATE: I aslo tried adding gem 'hashee' in the Gemfile before omniauth-facebook. No luck.
So I think you are just using bunder incorrectly.
bundle update doesn't resolve new dependencies, it simply looks at the gem manifest, which is stored in Gemfile.lock and updates those gems to the most recent gem allow by the constraints placed on them in the Gemfile.
Since you are trying to install a new gem, what you what to run is bundle install which will make a comparison between your Gemfile and your Gemfile.lock and install any gems that are not listed in your Gemfile.lock.
I think bundle install should do the trick for you.
As a side note, bundler tries to make this as easy as possible for you by aliasing bundle to bundle install. So, unless you are explicitly looking to update your gems, you can just type bundle and get the behavior that you are expecting.
I got it working. I think it was some problem with bundler. I did some different things, and I have to admit that I'm not 100% sure what fixed it. I think what did it was this:
gem uninstall bundler
gem install bundler
bundle install mail
However, it did not work until my second reinstall I think. Upon the install command, it installed everything, not just mail and its dependencies. The only other thing I did was to delete /usr/bin/bundler after the first reinstall. It did not reappear.

Getting Rails working with a JS runtime environment

I'm using Ubuntu 11.10 and the terminal to install and run Rails. Here
is the process I've taken so far to setup Rails:
download and install Ruby 1.9.2 and Rails 3.1.0
-- I did this using sudo apt-get ruby1.9.1 and sudo gem install
rails
I made a new rails app using rails new path/to/app
I went to the new app directory and tried running rails server and got an
error about not having a JS ruby environment
I had to get a JS runtime environment for execjs so I downloaded 'therubyracer'
as well as 'therubyrhino' and added them to my gem file, one at a time like this:
gem
'therubyracer' then ran bundle install
After everything was successful with the install, I ran rails server again
-- with both runtime environments I have had similar errors:
Could not find libv8-3.3.10.4 in any of the sources
Run `bundle install` to install missing gems.
Could not find therubyrhino-1.73.0 in any of the sources
Run `bundle install` to install missing gems.
Bundle knows where these programs live, giving correct pathnames when I
enter bundle show libv8 or bundle show therubyrhino. They are both
in /usr/lib/ruby/gems/1.9.1/gems/_ where all the other gems are
located for the bundle install.
Does anyone know where this exception is coming up in the Rails source
code? Does anyone know how Rails is gathering the gems? Better yet,
anyone had this problem and know how to fix it?
Thanks so much,
Feav
Have you tried starting the server using bundle exec rails server?
This problem has been fixed in a newer version of Rails.

Project folders and gems for Rails 3

I am new to Rails and have been trying to setup up my Mac to handle some development. I am currently in a project folder and trying to install a Gem and get this error:
*bash-3.2$ gem install pg
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.*
It appears its trying to install this to the 1.8 directory. I would like all gems to be installed only for this project and not for everything.
Here is my folder structure for Rails projects.
Rails Projects:
Project 1:
Project 2:
How do I correct the issue with the gem installation so it only goes into a specific folder. This goes for the ruby version as well.
Thanks for the help.
You need to be using RVM, the Ruby Version Manager, found at http://beginrescueend.com/
I assume you already have installed XCode and Macports (or something like it).
Install rails using "gem install rails"
Use "rails new new-project" to setup your new rails project
Use bundler to add any new gems to your project http://gembundler.com/
Finally, if you want to use MySQL, there is a trick to getting the mysql2 gem configured properly on Mac. That is covered in this stackoverflow post.
Without installing RVM, which you should be doing anyway, you just need to use sudo to install the gems. By default, your user account does not have write permissions to the default gem installation directory.
sudo gem install pg