Developing on x64 Windows 7 machine, Ruby 2.0, Rails 4.0.0.
To utilize has_password functionality, I needed to install BCrypt. Rails 4.0.0 supports BCrypt 3.0.0-3.0.9. However, those versions of BCrypt do not work on a x64 Windows machine and I had to update to BCrypt 3.1.2.
But, I also had to manually update the ..\activemodel-4.0.0\lib\active_model\secure_password.rb to reference bcrypt 3.1.2 (previously referenced ~>3.0.0)
begin
gem 'bcrypt-ruby', '~> 3.1.0'#changed from '~> 3.0.0'
require 'bcrypt'
rescue LoadError
$stderr.puts "You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install"
raise
end
Now my application and tests run locally. I made this change due to the answers on Issues using bcrypt 3.0.1 with ruby2.0 on Windows
However, now when I push to heroku, I get the following trace:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install
rake aborted!
can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.
2. Make sure all dependencies are added to Gemfile.
.
.
.
!
! Push rejected, failed to compile Ruby/Rails app
I don't know how to get my app to run locally and on heroku with these changes. I'm not sure if I need to push to heroku a different way, or if I need to address the bcrypt issue a different way. Any help would be great.
Not that the last version of bcrypt supported my rails at this moment (4.0.0) is the version 3.0.1.
If you try a version higher that, you will get the error.
Regards
PS
I resolved this by updating from bcrypt-ruby 3.0.1 to 3.1.5.
Related
Why am i getting 'uninitialized constant Mail::TestMailer' error with "Rails 6.1.5 & Ruby 3.1.0" while working without problems "Rails 6.1.5 & Ruby 3.0.1" ?
Found following from NEWS for Ruby 3.1.0.
The following default gems are now bundled gems.
net-ftp 0.1.3
net-imap 0.2.2
net-pop 0.1.1
net-smtp 0.3.1
matrix 0.4.2
prime 0.1.2
debug 1.4.0
So, i just added next 3 lines into GemFile. It worked fine.
gem 'net-smtp' # to send email
gem 'net-imap' # for rspec
gem 'net-pop' # for rspec
I had similar issue, after debugging and troubleshooting. I made changes to the Rails version to 6.1.1.4 instead of 6.1.7. The I got similar error stating that it could not load some .rb files from the mail gem.
What I did was to give them the read perssion to others.
chmod 644 .rb
and the application loaded fine after that.
I was getting same issue after deploying the code on server.
Version details-
Rails 6.1.5
ruby 3.1.2p20
I just install a new gem as-
gem 'net-smtp'
and issue got resolved.
When I try deploy using capistrano gem I get:
rake stderr: rake aborted!
LoadError: cannot load such file -- nokogiri/nokogiri
In my Gemfile.lock I can see that nokogiri is installed nokogiri (1.11.2-x86_64-darwin) which is for mac since I'm using mac for development, and when I do gem list in my production which is ubuntu I see nokogiri (1.11.2 x86_64-linux).
Based on one of the answers on SO, I removed -x86_64-darwin from nokogiri (1.11.2-x86_64-darwin) but this gave me:
Downloading nokogiri-1.11.2 revealed dependencies not in the API or the lockfile (mini_portile2 (~> 2.5.0)).
Either installing with `--full-index` or running `bundle update nokogiri` should fix the problem.
I ran bundle update nokogiri with no luck and it only said: Bundler attempted to update nokogiri but its version stayed the same.
I know this issue might happen since the nokogiri in my local is for mac and for development is for Linux.
I'm not sure what I can do to resolve this issue. Any feedback is appreciated.
Rails: 6.1.3
Ruby: 2.5.8
I've faced a similar problem and this helped me.
I've just started working on a very old legacy app for a client, which is running on Ruby 1.9.3, Rails 3.2, and using JRuby on the production server. (Obstacles in upgrading the server has been a contributor to remaining on 1.9.3.)
Adding a gem to the Gemfile, even though the gem is compatible with 1.9.3, and even though I've added
ruby '1.9.3', :patchlevel => '551'
to the top of the Gemfile, Bundler continually chooses versions of other gems that require Ruby 2.0, and so updating fails. How can I get around this, without having to manually specify every single gem version that it fails on.
For example:
...
Using quiet_assets 1.1.0
Using rails 3.2.22
Using ref 2.0.0
Using rspec-rails 2.14.2
Fetching rspec_junit_formatter 0.3.0 (was 0.2.3)
Installing rspec_junit_formatter 0.3.0 (was 0.2.3)
Gem::InstallError: rspec_junit_formatter requires Ruby version >= 2.0.0.
An error occurred while installing rspec_junit_formatter (0.3.0), and Bundler cannot continue.
Make sure that `gem install rspec_junit_formatter -v '0.3.0'` succeeds before bundling.
I had to specify gem 'rspec_junit_formatter', '0.2.3', as well as all of the previous failures, in order to get this working. But that seems to defeat the purpose of Bundler. Why is Bundler ignoring Ruby versions when it builds its dependency graph, even though I've explicitly told it what version of Ruby to use?
Bundler is not ignoring the ruby version. When it installs gems it does not look at each gem and do a smart pick of which one to choose to get rid of any dependency issues (including the ruby version dependency).
In your gemfile, by not specifying the gem version, bundler will try to install the highest version it can. This is why it is good practice to specify exact versions for all your gems- so that if an update comes out for a gem in the repo you are getting the gem from- your project does not break.
Specifying the ruby version in the gem file is just like specifying the gem version for particular gem- it installs that version but does not affect the installation of any other gems.
I am new to Rails and would like to check how Spree ecommerce solution looks like before the customization. That's why I installed Ruby from RubyInstaller, DevKit, Rails, Spree etc.
During installation of state_machines gem, below error appears and the gem is eventually not installed.
C:\>gem install state_machines
ERROR: While executing gem ... (Errno::EINVAL)
Invalid argument # rb_sysopen - C:/Dev/Ruby/lib/ruby/gems/2.1.0/gems/state_m
achines- 0.2.2/test/unit/node_collection/node_collection_after_being_copied_test.rb
This has impact on the bundle install of spree project later on:
Errno::EINVAL: Invalid argument # rb_sysopen - C:/Dev/Ruby/lib/ruby/gems/2.1.0/g
ems/state_machines-0.2.2/test/unit/node_collection/node_collection_after_being_c
opied_test.rb
An error occurred while installing state_machines (0.2.2), and Bundler cannot
continue.Make sure that `gem install state_machines -v '0.2.2'`
succeeds before bundling.
Current ruby version installed is:
ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32] + devkit
rails version is 4.2.0
I am running on Windows environment, without any possibility to move to Linux.
I ran into this too.
Looks like state_machines has some test case files that have a newline in the name.
I'd bet that is the cause of the issue.
I've submitted a pull request over here: https://github.com/state-machines/state_machines/pull/11
In the meantime, my branch doesn't have the issue: https://github.com/jeff-hamm/state_machines
The specific fix (for the moment, until the pullrequest is accepted) is:
git clone https://github.com/jeff-hamm/state_machines
cd state_machines
bundle gem state_machines
rake install
After doing that, 'gem install spree_core' worked just fine on windows.
Keep in mind I am not planning on keeping my branch up to date (I will delete it if the request is accepted), so, that clone url won't be ideal for long
I am making a Rails(3.0.4) application using the youtube_it API.
I installed the gem using gem install youtube_it, but when I run the script I get this error:
can't activate faraday (>= 0.7.3, runtime) for ["youtube_it-2.1.1"], already activated faraday-0.5.7 for ["instagram-0.8"]
How should I resolve this without removing the existing version of faraday?
First, you should be adding youtube_it to your Gemfile, then running bundle install.
This gives bundler enough information to figure out the dependency graph of all the gems your application needs. Bundler writes out the needed gems, their dependencies and versions to the Gemfile.lock file.
Second, when running the rails command, you shouldn't need to run bundle exec according to Yehuda Katz (http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/). However, in my experience there have been times when bundle exec has been necessary even for the rails command.
In any case, running "bundle exec executable" will run your executable (rails, rake, etc) with the gems listed in the Gemfile.lock, avoiding the dreaded "can't activate -- already activated" error.
I don't think you can. You should update faraday to its latest version. Is there a valid reason not to?