I created one app with device gem than run bundle instal.
than after i am trying to run this command
rails generate devise:install
but i am getting error
Could not find bcrypt-3.1.11 in any of the sources
Run `bundle install` to install missing gem...
I did bundle install
I tried this gem install bcrypt to install this gem
I tried to bundle update and than run
bundle exec rails generate devise:install
but still i am getting same error.
gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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 '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
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'devise'
Uncomment this line of your Gemfile:
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
and run bundle install again.
Remove all spring from your Gemfile.
gem "spring"
gem "spring-commands-rspec"
Run bundle install
Not sure why I tried to do another application with spring. :(
Run bundle update
I just experienced the same problem. I did what #Uday kumar das suggested and it worked perfectly!
It took me few hours to get this done but please feel free to share it.The root problem here is that Ruby itself comes with bcrypt version 3.1.5 which is having bugs with the newer updates.
However when you install or uninstall the bcrypt you are leaving behind bcrypt-ruby which it always asks for first and hence all what you are doing won't go through, so what to do?
uninstall bcrypt and bcrypt-ruby by running these two commands:
gem uninstall bcrypt and gem uninstall bcrypt-ruby
Install it again with:
gem install bcrypt --platform=ruby
In your Gemfile write:
gem 'bcrypt','~>3.1.11'
NOW as I write these lines the latest version is 3.1.11 but whatever version is updated just add it from their gem page. Run bundle install and it should work just fine.
I had the same problem. I fixed the problem by cloning the project into another folder and running bundle install in the newly cloned project. Then I was able to run the rails command again. Hope this helps.
I just had this same problem with bcrypt 3.1.12 after installing devise 4.6.2. I don't believe this is specific to crypt or devise, I believe this is a spring problem as others have indicated.
I was able to solve this problem simply by stopping spring and rerunning the rails generator with
spring stop
rails g devise:install
Try that before doing anything destructive or intrusive.
Add this line to your gemfile this code:
gem 'bcrypt'
and then run bundle install in console.
In my case, I uninstalled all versions of bcrypt, with gem uninstall bcrypt and select option 3 (if it exists), and uninstalled all versions of bcrypt-ruby gem with gem uninstall bcrypt-ruby and select option 3 (if it exists), then I installed bcrypt using gem install bcrypt --platform = ruby and I added this line gem 'bcrypt', '~> 3.1.7' in Gemfile. It worked right.
After search throught a lot of responses, for me this is the solution on Rails-5.0.2:
spring stop
bundle exec rake rails:update:bin
bundle exec spring binstub --all
gem pristine -a
bundle install
bundle update
solved this for me
I had these lines commented out as well due to a previous try, not sure if it helped.
# gem 'spring'
# gem 'spring-watcher-listen', '~> 2.0.0'
Related
I am attempting to install kaminari, but Rails cannot find it or a dependency (I've run into both - currently dependency):
∴ bundle exec rails g kaminari:config
Could not find i18n-1.8.4 in any of the sources
Run `bundle install` to install missing gems.
This is despite it being installed:
∴ bundle info i18n
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
* i18n (1.8.4)
Summary: New wave Internationalization support for Ruby
Homepage: https://github.com/ruby-i18n/i18n
Path: /Users/shawn/.rvm/gems/ruby-2.6.3#refstats/gems/i18n-1.8.4
I first attempted to delete Gemfile.lock. Same result. Then I deleted the refstats gemset and recreated it. Same result. Then I tried bundle install --force and got same result.
I've tried both gem 'kaminari', '~> 1.2' and gem 'kaminari' in my Gemfile.
Any suggestions?
EDIT:
Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.2'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3', '~> 1.4'
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# 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.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
gem 'devise', '~> 4'
gem 'kaminari'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Edit 2:
∴ cat .ruby-version
ruby-2.6.3
I have no .ruby-gemset, but my console is reporting I'm using the right one:
12:36:50 shawn#macbook-pro:~/Documents/uga/refstats (git:master:547a0b4) ruby-2.6.3#refstats
∴
EDIT 3:
Well, the gremlin has disappeared, though I cannot say why. This is what I did:
1) Created new test rails app
2) Bundle install in new gemset
3) Added kaminari to Gemfile
4) Bundle install
5) Generated kaminari config successfully
6) Switch to non-working app, but forget to switch gemset, putting me in rvm with no gemset. Don't notice.
7) Bundle install
8) Notice things get installed, including kaminari. Notice I'm on wrong gemset.
9) Switch to correct gemset.
10) Bundle install (which installs nothing)
11) Generate kaminari config successfully
I really cannot say why it started working, unless installing to the rvm root had some effect. But that's what I did, and it's all working now. Thanks for the time.
Just because the gem is installed on your machine does not mean it is part of your bundle. bundle exec scopes the available gems to only what is included in your Gemfile and those gems dependencies. See if i18n for that version shows up when you run bundle show.
I'm creating a website but have accidentally installed Ruby on Rails version 4 instead of version 5 and would like to upgrade to the latest version in order to use a few of the features that are currently missing from the version I have on my system.
I have tried following this guide:
http://railsapps.github.io/updating-rails.html
I installed rvm and ran all the preliminaries in order, up until this section:
rvm use ruby-2.3.1#rails5.0 --create
gem install rails
rails -v
Where I ran into problems. rvm use ruby-2.3.1#rails5.0 --create outputs:
ruby-2.3.1 - #gemset created /home/dev/.rvm/gems/ruby-2.3.1#rails5.0
ruby-2.3.1 - #generating rails5.0 wrappers..........
Using /home/dev/.rvm/gems/ruby-2.3.1 with gemset rails5.0
Fine. Gem install rails also proceeds without error, installing all 36 gems including, crucially:
Fetching: rails-5.0.1.gem (100%)
Successfully installed rails-5.0.1
and
Fetching: railties-5.0.1.gem (100%)
Successfully installed railties-5.0.1
However, when I run rails -v directly afterwards, I get:
Could not find proper version of railties (4.2.7.1) in any of the sources
Run `bundle install` to install missing gems.
When I run bundle install, however, the system reverts to rails 4.2.7.1.
Do I need to do something extra to install/link/whatever railties 4.2.7.1, and to stop the system reverting to the original version of rails? I don't use rails very much so I'm not particularly familiar with the configuration. Perhaps I need to change a config file within my app?
The problem was in the Gemfile, which contained old version numbers. I updated to the following:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.1'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.13', '< 0.5'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.6'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 3.0.4'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2.1'
# 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 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.4.1'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.1', 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
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
Then ran bundle update followed by bundle install and now have Rails 5.0.1. Thanks to Iceman for suggesting looking in the Gemfile!
I'm trying to learn Ruby on Rails.
Currently been trying out Rails framework. I've installed it. Create new project in MyBlog folder, but when I try to run:
rails server
I get back an error:
Could not find gem 'rails (= 4.2.5) x86-mingw32' in any of the gem sources listed in your Gemfile or available on this machine. Run `bundle install` to install missing gems.
I've installed bundle as suggested. Had few problems with installing it as well, but I've found a soultion on the internet.
Before bundle install I was getting another error saying that it could not find gem 'sqlite3'
Did someone had similar problem? Can you help me with solving it?
Update:
Content of my Gemfile is:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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 '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
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Errors when try to run 'bundle install':
Try to install the following packages to succeed bundle install
sudo apt-get install build-essential
sudo apt-get install libgmp3-dev
These packages are for Linux environment. Find the alternatives for other environments. Let me know if you got any error.
open file Gemfile.lock, find and delete "x64-mingw32" then run the command:-
$bundle install
Late answer but this happened to me just now.
What worked for me was figuring out I accidently installed an older Ruby version.
In your last screenshot you received a line:
Make sure that `gem install json -v '1.8.3'` succeeds before bundling
This command probably failed due to an older Ruby version, get the latest version here (Assuming you're a windows user) https://rubyinstaller.org/downloads/
P.S
Make sure you remove any previous Ruby / Rails installations.
What you need is a "With DEVKIT" installer, preferably the one they recommend on (starts with "=>").
After creating a Ruby on Rails skeleton (before pushing to master and Heroku) and running: bundle install, I sometimes encounter the following error:
An error occurred while installing pg (0.18.2), and Bundler cannot continue
Make sure that gem install pg -v '0.18.2' succeeds before bundling.
The following command remediates the issue altogether: bundle install --without production.
Why exactly does the aforementioned command remediate the issue? As I understand, the command bypasses production environment gems for deployment; so, is my understanding correct and why must this be the case? Thank you!
Here is my gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# 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/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
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development do
gem 'sqlite3'
end
gem 'bootstrap-sass'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
The best resource answering the "why" component of this question appears to be explained thusly by Michael Hartl's Ruby on Rails Tutorial:
"Heroku uses the PostgreSQL database...which means that we need to add the pg gem in the production environment to allow Rails to talk to Postgres...Generally speaking, it's a good idea for the development and production environments to match each other as closely as possible, which includes using the same database, however we'll use SQLite locally and PostgreSQL in production."
So, basically it appears that the issue is a matter of maintaining conventions between two different environments- production and development (local)- and more specifically, database types (Postgres vs SQLite), which is why bundle install --without production is required:
"To prepare the system for deployment to production, we run bundle install with a special flag to prevent the local installation of any production gems (which in this case consist of ph and rails_12factor)...Because the only gems added are restricted to a production environment, right now this command doesn't actually install any additional local gems, but it's needed to update Gemfile.lock with the pg and rails_12factor gems."
If the remediation for Heroku deployment bundle install --without production is an acceptable alternative to bundle install, it just seems too bad to be true; if so, is there another setting or file I can revise in order to achieve the same results effected by the regular bundle install? Thanks!
I'am fairly new in Ruby and terms of deploying app through remote tools. I've tried to deploy my App on free openshift account. And I connot run application.
When I run application i get this error:
You have already activated rack 1.5.2, but your Gemfile requires rack 1.6.0.
Using bundle exec may solve this. (Gem::LoadError)
So I try to run bundle exec but i got another error:
Gemfile syntax error:
/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/Gemfile:24:
syntax error, unexpected ':', expecting $end
gem 'sdoc', '~> 0.4.0', group: :doc
I think it might be because I used Ruby 2.1.5 on local and Open shift runs Ruby 2.0 by default.
I had foud this topic How can I force a bundle install on OpenShift Online when my RAILS_ENV is set to development?
but i don't know if I am doing it right. I don't even know where to put this pre_build file. I tried to put it under /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/.openshift/action_hooks/ . But I'm not sure if runtime is right repo.
EDIT 1:
This it my Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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/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.
group: :doc do
gem 'sdoc', '~> 0.4.0'
end
# 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
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
SOLUTION:
As #Rajarshi Das said I had to change
gem 'sdoc', '~> 0.4.0', group: :doc
into
group: :doc do
gem 'sdoc', '~> 0.4.0'
end
I don know exactly why. Maybe some syntax issues as I was using Ruby 2.1.5 on local, and had to use 2.0.0 on production. And after that I had to run gem install rails even though I used rails quick start. Finally I had to manually add to Gemfile gem 'nokogiri'. Finally I could run bundle install and application started to work.
You can simply solve the error by following way
group :doc do
gem 'sdoc', '~> 0.4.0'
end
For platforms
platforms :jruby, :mingw, :mswin do
gem 'tzinfo-data'
end
Remove Gemfile.lock as You have already activated rack 1.5.2, but your Gemfile requires rack 1.6.0
Then check bundle install
I ssh to $app_root directory
gem install rack
it worked
Make sure your branch is being used for deployment
rhc app-configure --deployment-branch [BRANCH]
Then in your development environment update gems
# bundle install
It will change Gemfile.lock
$ git add -A
$ git commit -am "Updating gemfile"
$ git push
Wait until deployment is updated
I tried most of the solutions here, but I still got stuck. What the problem was is to install bundle for the current version of ruby being used. You will want to do a gem install bundler in app-root/runtime/repo.
Then RAILS_ENV=production bundle exec rails console
You can refer to this answer