Can't install Devise - ruby-on-rails

Trying to install Devise and I get the following message "Could not find generator devise:install."
leigh#leigh-VirtualBox:~/Projects/dev01$ bundle install
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.0
Using thread_safe 0.3.4
Using tzinfo 1.2.1
Using activesupport 4.1.4
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.4
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.4
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.4
Using activemodel 4.1.4
Using arel 5.0.1.20140414130214
Using activerecord 4.1.4
Using execjs 2.2.1
Using autoprefixer-rails 2.1.1.20140710
Using bcrypt 3.1.7
Using sass 3.2.19
Using bootstrap-sass 3.2.0.0
Using thor 0.19.1
Using railties 4.1.4
Using bootswatch-rails 3.2.0
Using coffee-script-source 1.7.1
Using coffee-script 2.3.0
Using coffee-rails 4.0.1
Using data-confirm-modal 1.0.1 from git://github.com/ifad/data-confirm-modal.git (at master)
Using declarative_authorization 0.5.7
Using orm_adapter 0.5.0
Using warden 1.2.3
Using devise 3.2.4
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.1.3
Using jquery-rails 3.1.1
Using bundler 1.6.4
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.3
Using rails 4.1.4
Using rdoc 4.1.1
Using sass-rails 4.0.3
Using sdoc 0.4.0
Using spring 1.1.3
Using sqlite3 1.3.9
Using turbolinks 2.2.2
Using uglifier 2.5.3
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
leigh#leigh-VirtualBox:~/Projects/dev01$ rails generate devise:install
Could not find generator devise:install.
leigh#leigh-VirtualBox:~/Projects/dev01$
My Gemfile is:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
gem 'bootstrap-sass', '~> 3.2.0.0'
gem 'bootswatch-rails', '~> 3.2.0'
gem 'autoprefixer-rails'
# Use data-confirm-modal to create custom alert modal popups
gem 'data-confirm-modal', github: 'ifad/data-confirm-modal'
# Use devise for user authentication
gem 'devise'
# Use declarative_authorization for user authorisation
gem 'declarative_authorization'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
Rails version is:
leigh#leigh-VirtualBox:~/Projects/dev01$ rails -v
Rails 4.1.4
leigh#leigh-VirtualBox:~/Projects/dev01$
OS version is:
leigh#leigh-VirtualBox:~/Projects/dev01$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
leigh#leigh-VirtualBox:~/Projects/dev01$
Any ideas as to why the Devise gem won't install after correctly adding it to the Gemfile and running the bundle install?
I did have the server running at one point (rails server) and saw an article stating that attempting to install Devise whilst the server is up could cause strange issues.
I've since tried again with the server down but no difference. I'm sure this is probably happening due to something really simple that I overlooked in the setup, just not sure where else to look.
Any advise or suggestions on where to look next would be great, thanks.
I've done testing using the command below but still received the same error:
leigh#leigh-VirtualBox:~/Projects/dev01$ bundle exec rails g devise:install
Could not find generator devise:install.
The list of installed generators are below and Devise is not listed, how do I get it listed?
leigh#leigh-VirtualBox:~/Projects/dev01$ rails generate
Usage: rails generate GENERATOR [args] [options]
General options:
-h, [--help] # Print generator's options and usage
-p, [--pretend] # Run but do not make any changes
-f, [--force] # Overwrite files that already exist
-s, [--skip] # Skip files that already exist
-q, [--quiet] # Suppress status output
Please choose a generator below.
Rails:
assets
controller
generator
helper
integration_test
jbuilder
mailer
migration
model
resource
scaffold
scaffold_controller
task
Coffee:
coffee:assets
Jquery:
jquery:install
Js:
js:assets
TestUnit:
test_unit:generator
test_unit:plugin
leigh#leigh-VirtualBox:~/Projects/dev01$

same problem today, I removed the 'spring' out from the Gemfile and it did the trick.
or you can turn off your spring first and run rails generate devise:install

OK, I'm still not 100% sure why this worked or what caused the issue in the first place but after running the following commands:
leigh#leigh-VirtualBox:~/Projects/dev01$ gem uninstall devise
Successfully uninstalled devise-3.2.4
leigh#leigh-VirtualBox:~/Projects/dev01$ gem uninstall warden
Successfully uninstalled warden-1.2.3
leigh#leigh-VirtualBox:~/Projects/dev01$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
[... text removed ...]
Installing warden 1.2.3
Installing devise 3.2.4
[... text removed ...]
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
leigh#leigh-VirtualBox:~/Projects/dev01$ rails generate devise:install
create config/initializers/devise.rb
create config/locales/devise.en.yml
Woo Hoo!!! problem solved. Great way to waste a couple of days :-(

What worked for me was:
$ sudo -s
$ bundle exec rails generate devise:install
Without sudo or running the "initializer" /bin/bash --login didn't work. The other solution could be to remove the Gemfile.lock and run bundle install again.

This seems to work on my machine under RVM, but that's with a fresh gemset. If you're using version of Ruby (or an RVM gemset) shared with other Rails installs, you could be having problems there.
As you're using Bundler you should probably use:
bundle exec rails g devise:install
as a general precaution, to ensure you're using the bundle's gems.

I fixed it by adding the following line to my Gemfile:
gem 'devise'
After adding that line, I executed bundle install.

I had the same problem today. I tried uninstalling devise and warden but no luck. Finally I deleted the Gemfile.lock and ran bundle install again and that did the trick.

This will sound ridiculous but open a new terminal window and try again. That's what it ended up being for me. If that still doesn't work, try:
DISABLE_SPRING=1 bundle exec rails g devise:install

I had the same problem today in vscode terminal, try remove the gemfile.lock and if doesn't work, repeate the below process.
You can remove de gemfile and after try bundle install on a new terminal.
I'm think this is a permission problem on vscode.
In first step you can remove the line of devise on gemfile and add again manually -> gemfile 'devise'
Steps:
1.0 try on your terminal.
1.1 remove gemfile.lock.
1.2 run bundle install.
1.3 run rails g devise:install.
If doesn't work
2.0 Quit the terminal e open a new.
2.1 try run the same steps on 1.1 to 1.3
Solved to me.

In my case, I was using:
gem 'rack-cors', :require 'rack-cors'
Then I got the same error but none of the solutions here solved it.
I had to replace it just to be like this:
gem 'rack-cors'
then run
$ bundle install
$ rails generate devise:install

I close my terminal and open a new one.
Then rails generate devise:install
It works this time. It is so weired!

Restarting the console will fix this issue.

Related

Why is Ruby not updating after updating with Ruby Installer?

I am currently have Ruby version 2.2.6 installed on my Windows 10 machine but need to update order to use the shopify_app gem. I downloaded Ruby 2.5.1-2 (x64) wıthout the devkit as it says on the Ruby Installer site and followed the prompts. I seemingly finished the installation , but entering ruby -v in the command line tells me I am still useing version 2.2.6. I have also tried bundle update which gives the following:
C:\Sites\postgresapp>bundle update
The dependency byebug (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86-mingw32 but the dependency is only for ruby. To add those platforms to the bundle, run `bundle lock --add-platform ruby`.
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies........
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 1.0.1
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.0.7
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.4 (x86-mingw32)
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Using actionview 5.0.7
Using rack 2.0.5
Using rack-test 0.6.3
Using actionpack 5.0.7
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.0.7
Using globalid 0.4.1
Using activejob 5.0.7
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.0.7
Using activemodel 5.0.7
Using activemodel-serializers-xml 1.0.2
Using arel 7.1.4
Using activerecord 5.0.7
Using activeresource 5.0.0
Using bindex 0.5.0
Using bundler 1.16.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.0.7
Using coffee-rails 4.2.2
Using multipart-post 2.0.0
Using faraday 0.12.2
Using ffi 1.9.25 (x86-mingw32)
Using graphql 1.8.5
Using graphql-client 0.13.0
Using hashie 3.5.7
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using jquery-rails 4.3.3
Using jwt 1.5.6
Using multi_xml 0.6.0
Using oauth2 1.4.0
Using omniauth 1.8.1
Using omniauth-oauth2 1.5.0
Using omniauth-shopify-oauth2 1.2.1
Using pg 0.21.0 (x86-mingw32)
Using puma 3.12.0
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.0.7
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using sass-listen 4.0.0
Using sass 3.5.7
Using tilt 2.0.8
Using sass-rails 5.0.7
Using shopify_api 4.12.0
Fetching shopify_app 8.2.6
Installing shopify_app 8.2.6
Gem::InstallError: shopify_app requires Ruby version >= 2.3.1.
An error occurred while installing shopify_app (8.2.6), and Bundler cannot
continue.
Make sure that `gem install shopify_app -v '8.2.6' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
shopify_app
EDIT: ADD GEMFILE
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'shopify_app', '~> 8.2.6'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.6'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'simple_form'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
"gem 'shopify_app'"
How can I complete the installation of the latest version of Ruby?
You need to update your PATH environment variable, it is still pointing to the old installation. If I remember correctly, the installer does have a box to check off to set the PATH variable. Only one installation at a time can be in your PATH.
See this answer for a quick way to change the variable. It will follow the same syntax as the following.
Open cmd.exe and type:
set PATH=%PATH%;C:\Ruby250\bin
Your installation location may be different, confirm before entering. You can also do it through the properties window of MyComputer or whatever they call it now. I find the terminal to be simpler, as it take abouts 6 windows deep to change through the GUI.
Step By Step:
Find the directory where ruby is installed to, usually
C:\Ruby250\bin (version may vary)
Open a command prompt, terminal, cmd.exe, or whatever name you
prefer to call it.
Type set PATH=%PATH%;C:\Ruby250\bin (change folder name if yours
is different)
Press Enter button
In a new cmd.exe, type ruby -v
Enjoy
ANOTHER EDIT
Click on the "Start" button (probably bottom-left of your screen)
Start typing the word "environment" until you see the option Edit
the system environment variables appear
Click on that
A small window will open, towards the bottom left is a button that
reads Environment Variables
Click on that button
There will be two sections, one for the user (that is current account
only) and the other is the "system", which is the default and
system-wide variables
In each of these (just to be sure), highlight the line that has
"Path" for the name of the variable
Find the button under the list that you just clicked in that reads
Edit...
Click on it
Look through list, it is different for everyone, can't read it for
you. Find the one that it is the location of a Ruby installation,
mine reads C:\Ruby24\bin because I am using Ruby 2.4.4
YOU NEED TO MAKE SURE THAT THE FOLDER PATH IS WHERE YOU INSTALLED
RUBY. This cannot be done for you, only you know. It is by default
C:\RUBY***\bin, where the *** is your version number. You have to
open explorer and simply look.
If the variable is where is where Ruby 2.5 is installed, good, it
doesn't need changed, but look through the list to make sure there
are no other paths to other versions of Ruby. If there are, highlight
them and click the delete the button to remove.
Click OK on each window that you may have made an edit, not
Cancel, and not X out the window.
To confirm it works, open a new command window, if one was already
open, the changes will not be updated in it.

Working on a Rails app and missing some software on my Mac OSX 10.6.8

I'm following this guide as part of a web development curriculum, so I'm sure I'll fully understand what each part does later on, but for now I'm just doing what it says and figuring out everything I can based on what I know. The previous chapter (creating an app) was a success, but now I've stumbled against this instruction. I can't edit that line because it doesn't exist. This is Gemfile, as viewed in TextEdit:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use jdbcsqlite3 as the database for Active Record
gem 'activerecord-jdbcsqlite3-adapter'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyrhino'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
The app runs fine and the server runs fine (though it doesn't have to be running for this so I guess it's not all that relevant). There's very likely something wrong with the guide, but what is it? Is there any point in building this now or should I keep learning and come back to it when I have more knowledge of Rails, and Ruby itself for that matter?
EDIT: I added the lines at the end of Gemfile and ran bundle install (thanks #Antarr Byrd!) but I got an error message. I'm posting the entire log just in case:
Mac-2:test_app mac$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies.............
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.3
Using activejob 4.2.1
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.0
Using activerecord 4.2.1
Using activerecord-jdbc-adapter 1.3.15
Using jdbc-sqlite3 3.8.7
Using activerecord-jdbcsqlite3-adapter 1.3.15
Using bundler 1.9.1
Using coffee-script-source 1.9.1
Using execjs 2.4.0
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.2.1
Using coffee-rails 4.1.0
Using hike 1.2.3
Using multi_json 1.11.0
Using jbuilder 2.2.12
Using jquery-rails 4.0.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/mac/.rvm/rubies/jruby-1.7.19/bin/jruby -r ./siteconf20150329-367-1xqntht.rb extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.
(root) at /Users/mac/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/mkmf.rb:8
require at org/jruby/RubyKernel.java:1071
(root) at /Users/mac/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
(root) at extconf.rb:2
extconf failed, uncaught signal 1
Gem files will remain installed in /Users/mac/.rvm/gems/jruby-1.7.19/gems/pg-0.18.1 for inspection.
Results logged to /Users/mac/.rvm/gems/jruby-1.7.19/extensions/universal-java-1.6/1.9/pg-0.18.1/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
gem install pg -v '0.18.1' is also giving me trouble.
Mac-2:test_app mac$ gem install pg -v '0.18.1'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/mac/.rvm/rubies/jruby-1.7.19/bin/jruby -r ./siteconf20150329-383-1d9a2xw.rb extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.
(root) at /Users/mac/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/mkmf.rb:8
require at org/jruby/RubyKernel.java:1071
(root) at /Users/mac/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
(root) at extconf.rb:2
extconf failed, uncaught signal 1
Gem files will remain installed in /Users/mac/.rvm/gems/jruby-1.7.19/gems/pg-0.18.1 for inspection.
Results logged to /Users/mac/.rvm/gems/jruby-1.7.19/extensions/universal-java-1.6/1.9/pg-0.18.1/gem_make.out
I'm stumped about these error messages. If anyone can explain at least the basics of what's going on and how to fix it I'd really appreciate it.
EDIT 2: I tried updating Ruby to 2.2 and it says I need clang 3.0 or higher, which I do have. This is the same problem I had earlier today when trying to install Python 3 and I still can't figure out what I'm doing wrong.
Mac-2:~ mac$ rvm install 2.2
ruby-2.2.0 - #removing src/ruby-2.2.0..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.6/i386/ruby-2.2.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx_brew.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/mac/.rvm/rubies/ruby-2.2.0, this may take a while depending on your cpu(s)...
ruby-2.2.0 - #downloading ruby-2.2.0, this may take a while depending on your connection...
ruby-2.2.0 - #extracting ruby-2.2.0 to /Users/mac/.rvm/src/ruby-2.2.0....
ruby-2.2.0 - #applying patch /Users/mac/.rvm/patches/ruby/2.2.0/fix_installing_bundled_gems.patch.
ruby-2.2.0 - #configuring.
Error running './configure --prefix=/Users/mac/.rvm/rubies/ruby-2.2.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --enable-shared',
showing last 15 lines of /Users/mac/.rvm/log/1427607081_ruby-2.2.0/configure.log
[2015-03-29 02:31:46] ./configure
current path: /Users/mac/.rvm/src/ruby-2.2.0
GEM_HOME=/Users/mac/.rvm/gems/jruby-1.7.19
PATH=/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/mac/.rvm/gems/jruby-1.7.19/bin:/Users/mac/.rvm/gems/jruby-1.7.19#global/bin:/Users/mac/.rvm/rubies/jruby-1.7.19/bin:/usr/local/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin/python:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/X11/bin:/Users/mac/.rvm/bin
GEM_PATH=/Users/mac/.rvm/gems/jruby-1.7.19:/Users/mac/.rvm/gems/jruby-1.7.19#global
command(5): ./configure --prefix=/Users/mac/.rvm/rubies/ruby-2.2.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --enable-shared
config.guess already exists
config.sub already exists
checking build system type... i386-apple-darwin10.8.0
checking host system type... i386-apple-darwin10.8.0
checking target system type... i386-apple-darwin10.8.0
i686-apple-darwin10-gcc-4.2.1: error trying to exec 'cc1': execvp: No such file or directory
configure: error: clang version 3.0 or later is required
There has been an error while running configure. Halting the installation.
Mac-2:~ mac$ ruby -v
jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-462-10M4609 +jit [darwin-x86_64]
Mac-2:~ mac$ which clang
/usr/bin/clang
Mac-2:~ mac$ clang -v
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
EDIT 3: fixed it without having to update LLVM or Clang or anything. I just had to get rid of jruby and use Ruby 2.2 instead.
Mac-2:rubies mac$ rm -rf jruby-1.7.19/
Mac-2:rubies mac$ brew install ruby
Mac-2:test_app mac$ gem install pg -v '0.18.1'
Mac-2:test_app mac$ bundle install
Even though I'm having some issues with Heroku itself, this was successful, so I'm accepting Antarr Byrd's answer.
Just add it to you Gemfile and do bundle install
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use jdbcsqlite3 as the database for Active Record
gem 'activerecord-jdbcsqlite3-adapter'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyrhino'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
A couple notes/questions/ideas:
1) Your question subject implies this has something to do with Heroku, but all of your logs / output are from your local Mac. Should edit to reflect that for future answer-seekers
2) You're running using JRuby 1.7, which is a somewhat odd choice for a first app. Looking at the Railsbridge docs you said you were following, they have you use Ruby 2.2, which is a much more common platform. I would follow Step 7 from their guide to get 2.2 installed with RVM and then try it again.
If your database is sqlite then you need to add
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
If it is mysql just replace gem 'sqlite3' with gem 'mysql2'

The bundle currently has rails locked at 3.2.12. whats to do?

I've changed in my gemfile the rails version from 3.2.12 to 4.2.0
then I got this error:
The bundle currently has rails locked at 3.2.12
so I tried bundle update / and bundle update rails ... but I got this:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
prototype-rails (>= 0) ruby depends on
rails (~> 3.2) ruby
rails (4.2.0)
What do I have to do?
Update Gemfile:
source 'http://rubygems.org'
#gem 'rails', '3.2.12'
gem 'rails', '4.2.0'
gem "airbrake"
#gem "mysql"
gem 'mysql2', '~>0.3.7'
gem 'fastercsv'
gem 'newrelic_rpm', :group => [:production, :staging]
gem "xml-simple", :require => "xmlsimple"
gem "will_paginate", "~> 3.0.0"
gem "json", '1.7.7'
gem "default_value_for"
gem "whenever"
gem 'charlock_holmes'
gem 'prototype-rails'
gem 'rails_autolink'
group :development do
gem 'capistrano'
gem 'capistrano-ext'
end
Just run
bundle update
without telling to update just a specific gem (like rails). This allows bundler to find the lastest possible combination for all gems in the Gemfile.
The prototype-rails gem is not actively supported anymore. You should try to replace it as soon as possible (even if the latest version still works for you).
Furthermore: Multiple configuration settings have changed between Rails 3.2 and 4.2, you will have to change some of your config and core files. You also might want to read the Rails Guide: Upgrading Rails.
I suggest to upgrade your app in smaller steps (3.2 -> 4.0, 4.0 -> 4.1, 4.1 -> 4.2). Make sure that the app works in each step before you continue to the next. Also, watch out for deprecation warnings in the console or the logs.
remove your gemfile.lock
rm Gemfile.lock
then add
rails 4.2.0 in your Gemfile
then
bundle install
I think, the problem is in prototype-rails
https://github.com/rails/prototype-rails
Below Comment of prototype-rails gem
Unfortunately, due to limited manpower and resources, the Rails core team has not been able to confirm if this gem currently works with Rails 4.1 and above. If you have found any problems while upgrading your application, please report them at the issue tracker, or better yet, submit patches by sending a pull request.
Tried to remove first remove prototype-rails then run
bundle update

Error: Permission Denied # rb_sysopen when trying to install gem pg in my rails app (Windows 7)

Using windows 7 ultimate and running cmd as administrator.
I have recently started working with ruby on rails and in my new rails app I'm attempting to install postgres(pg) gem and then I get a permission denied error as shown below:
C:\wamp\www\RailsApp>bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/...........
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.8
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.8
Using rack 1.5.2
Using rack-test 0.6.3
Using actionpack 4.1.8
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.1.8
Using activemodel 4.1.8
Using arel 5.0.1.20140414130214
Using activerecord 4.1.8
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.8
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.6
Using jquery-rails 3.1.2
Errno::EACCES: Permission denied # rb_sysopen - C:/Ruby21/lib/ruby/gems/2.1.0/ge
ms/pg-0.18.1-x86-mingw32/lib/2.1/pg_ext.so
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
I have tried
gem install pg
which leads to the same error.
However... when I try
gem install pg -mingw32
It appears successfull:
C:\wamp\www\RailsApp>gem install pg -mingw32
Fetching: pg-0.18.1-x86-mingw32.gem (100%)
Successfully installed pg-0.18.1-x86-mingw32
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.18.1-x86-mingw32
Installing ri documentation for pg-0.18.1-x86-mingw32
Done installing documentation for pg after 16 seconds
1 gem installed
Though after searching through several posts I fail to find a solution to how I can implement this with the gemfile to make the bundler run without errors nor find a solution to why I get the permission denied error in the first place.
Here is my current gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
Note: I have tried using
gem 'pg', platform: :mingw
yet, the error still occurs.
Hope this helps as to make my problem clear and feel free to ask and I'll supply more data possible.
Any suggestions are valued and accepted, thank you.
If you are on windows, use thisgem install pg -mingw32
It looks like bundle is trying to install things in the
C:/Ruby21/lib/ruby/gems/2.1.0/ge
ms/pg-0.18.1-x86-mingw32/lib/2.1/
directory and your user (or the process that is executing bundle) does not have permission to write things to that particular directory.
I am no expert on bundle, but one troubleshooting step you could try is to run a windows command prompt as administrator explicitly. You can do this by searching for CMD, then right-clicking on it and selecting "run as administrator". This sometimes corrects file permissions issues when installing things in windows.

Error when use session_store in Rails 4

I know session_store has removed from Rails 4.
So I try install it, but have some errors:
Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'activerecord-session_store', github: 'rails/activerecord-session_store', plataform: :mri
Console
Bundle Install
C:\Sites\rails-estudo-blog>bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.10)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using sqlite3 (1.3.8)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\Sites\rails-estudo-blog>
Trying install the gem
C:\Sites\rails-estudo-blog>rails generate active_record:session_migration
Could not find generator active_record:session_migration.
Trying create a session store migration
C:\Sites\rails-estudo-blog>rails generate active_record:session_migration
Could not find generator active_record:session_migration.
C:\Sites\rails-estudo-blog>
Informations
Rails 4.0
Ruby 2.0
Windows 7 x64 Professional
What's wrong? I follow all the steps of the repository: https://github.com/rails/activerecord-session_store
Works!
I re-write the file, and works (I don't know the problem), but I have another problem (I use proxy).
$ bundle install
Fetching git://github.com/rails/activerecord-session_store.git
fatal: unable to connect to github.com:
github.com[0: 192.30.252.129]: errno=No error
Git error: command `git clone
"git://github.com/rails/activerecord-session_store.git"
"c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/cache/bundler/git/activerecord-session_store-cf0cfe22b7614cc4fcd416e139ff2bd62ebd6f1d"
--bare --no-hardlinks` in directory c:/Sites/rails-estudo-blog has failed.
Solved
I can solve the problem change the url to:
gem 'activerecord-session_store', git: 'https://github.com/rails/activerecord-session_store'
So, I change github to git and put the entire url I want.
Thanks!
Update with new answer:
After you provided the entire Gemfile, I copied it and tried it directly. I saw the same problems you had. So, I retyped the line. It worked. I can't say exactly what is wrong within the line, but this works:
gem 'activerecord-session_store', github: 'rails/activerecord-session_store'
Copy and try it. If it still fails, delete it and retype it. The original line was just ignored without any message or reason and the bundle succeeded but missed this gem. The newly typed line worked. Go figure.
I left out "plataform: :mri", corrected to "platform: :mri", as it was extraneous.
Be sure to still follow the steps outlined below in my original answer. They still apply.
Please let me know..
End of update with new answer. Old answer follows:
I tried this for you, updating Gemfile and running bundle install. The result added the desired gem, and you can see the initial fetch from git (This was executed with Rubymine, thus the complex command line.):
D:\BitNami\rubystack-1.9.3-12\ruby\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) D:/BitNami/rubystack-1.9.3-12/projects/utilities/bin/bundle install
Fetching git://github.com/rails/activerecord-session_store.git
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
...
Using activerecord-session_store (0.0.1) from git://github.com/rails/activerecord-session_store.git (at master)
...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Process finished with exit code 0
Checking the status, I found:
D:\BitNami\rubystack-1.9.3-12\projects\utilities\app\helpers>bundle show activerecord-session_store
D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/bundler/gems/activerecord-session_store-022d45b4ae9b
Running the generate created the migration:
D:\BitNami\rubystack-1.9.3-12\projects\utilities>rails generate active_record:session_migration
create db/migrate/20131002090526_add_sessions_table.rb
The migration is as follows:
class AddSessionsTable < ActiveRecord::Migration
def change
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :sessions, :session_id, :unique => true
add_index :sessions, :updated_at
end
end
Interestingly, gem list didn't show the gem I expected, even though the bundle and generate worked:
D:\BitNami\rubystack-1.9.3-12\projects\utilities>gem list activerecord-session_store
*** LOCAL GEMS ***
D:\BitNami\rubystack-1.9.3-12\projects\utilities>gem list activerecord-session_store -r
*** REMOTE GEMS ***
activerecord-session_store (0.0.1)
But, gem install fixed that:
D:\BitNami\rubystack-1.9.3-12\projects\utilities>gem install activerecord-session_store
Fetching: activerecord-session_store-0.0.1.gem (100%)
Successfully installed activerecord-session_store-0.0.1
1 gem installed
D:\BitNami\rubystack-1.9.3-12\projects\utilities>gem list activerecord-session_store
*** LOCAL GEMS ***
activerecord-session_store (0.0.1)
Recommendations:
Run the gem install to make sure you have it installed.
Run the gem list to double check.
Run bundle update, not bundle install, to build the bundle from scratch.
Check the listing to ensure the gem is included as expected.
Run the bundle show to double check, again...
Run the rails generate to generate the migration.
If the migration fails to run again, check your gem storage for the generator in your gem storage:
.../gem/activerecord-session_store-0.0.1/lib/active_record/session_store.rb

Resources