Can't install ffi gem, Rails fail - ruby-on-rails

While creating creating an integration test via rails generate integration_test foo it declined with
Could not find ffi-1.0.9 in any of the sources
Run `bundle install` to install missing gems.
I ran bundle install to install missing gems, but with no success. Still the same error. I have gem 'ffi' in my Gemfile.
I switched the gemfile line to gem 'ffi', :git => 'git://github.com/ffi/ffi.git' and bundle installed again. It did all sort of stuff and wrote "Your bundle is complete" at the end.
However when I run the rails generate... command again I get:
git://github.com/ffi/ffi.git (at master) is not checked out. Please run 'bundle install'
What the hell is going on with this ffi?

I ran into the same problem and solved it by removing the Gemfile.lock and re-run bundle install.

Perhaps try 'bundle exec rails generate...'

bundle install was failing because it could ffi failed with NoMethodError for spec.
Removing Gemfile.lock, empty the gemset and doing bundle install worked.

Related

How to downgrande a gem in the gemfile?

I have this in my Gemfile.lock
sequel (5.15.0)
I want to downgrade the gem version to the 4.39.0 so I go in my Gemfile and add a version next to the gem declaration:
gem 'sequel', '4.39.0'
and run bundle exec bundle install
But it gives me:
You have requested:
sequel = 4.39.0
The bundle currently has sequel locked at 5.15.0.
Try running `bundle update sequel`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
Run `bundle install` to install missing gems
.
So I try to run bundle exec bundle update sequel but it returns me the same message.
How can I downgrade the gem?
You need to just call
bundle update sequel
without the bundle exec in front.
The issue you experienced is caused by bundle exec evaluating your current Gemfile for executing the latter command first. Here, it finds the difference between the specified gems in the Gemfile and your current Gemfile.lock and bails out.
In general, no bundle calls need to ever be prefixed with a bundle exec.
First try to update the dependent gems. It could be that there are some broken dependencies to other gems if you are downgrading.
Best practice:
bundle update sequel dependent_gemnames...
If you do not find out the dependent gems you can also try to update all your gems. But attention! This can cause unwanted side effects.
bundle update
And the last and ugliest option is to remove your Gemfile.lock and run
bundle install
This will rebuild your full Gem Stack and should be able to create a working Gemfile.lock

Windows, Ruby on rails bundle installer issue

I've no idea what happened, but I've started getting this error:
c:\Sites\Project>ruby bin/rails server
Your bundle is locked to rake (12.0.0), but that version could not be found in any of the sources listed in your Gemfile.
If you haven't changed sources, that means the author of rake (12.0.0) has removed it.
You'll need to update your bundle to a different version of rake (12.0.0) that hasn't been removed in order to install.
Run `bundle install` to install missing gems.
I've been using railsinstaller 2.3, and after getting it switched over to 2.2, but it is not helping.
Running bundle install produces exact same error text.
Ran
gem install rubygems-bundler
gem regenerate_binstubs
then
bundle install

Your bundle is locked to rake (12.0.0), but that version could not be found in any of the sources listed in your Gemfile.

I get the following error message when starting the rails server:
Your bundle is locked to rake (12.0.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of rake (12.0.0) has removed it. You'll need to update your bundle to a different version of rake (12.0.0) that hasn't been removed in order to install.
I specified gem 'rake', '12.0.0' in the gemfile but that doesn't fix it. I tried bundle update rake, deleting the Gemfile.lock and generating it with bundle exec bundle install. I also prepended `bundle exec1 to al my commands which does nothing.
My Gemfile.lock already specifies rake version 12.0.0, and there are no other versions installed.
See my gemfile:
http://pastebin.com/L4tVFWz9
And rakefile:
http://pastebin.com/K7p2ajsE
I tried the solutions suggested in Already activated rake version different than what Gemfile requires prevents rake commands
Different methods to solve this issue,
Step1:
gem install rubygems-bundler
gem regenerate_binstubs
Step2:
Remove the vendor/bundle directory.
Run bundle install to rebuild it
Step3:
Try, gem update bundler
Here is a link where the issue got solved. Check this is very useful
Try:
gem install rubygems-bundler
gem regenerate_binstubs
Not really a fundamental solution, but if you really have to run some Rails commands urgently and needs a temporary fix, try bundle exec rails c rather than bin/rails c.
Enter command :-
bundle update rake

Could not find rake with bundle exec

When I try execute 'bundle exec rake anything', I get error:
Could not find rake-10.1.0 in any of the sources.
Run `bundle install` to install missing gems.
But when I execute simple 'rake anything', rake is working.
Of cause, I tried setup gem any way, which I know:
gem install rake -v=10.1.0
Wrote "gem 'rake', '10.1.0'" in Gemfile, then execute bundle install
I installed gem for all rvm: rvm all do gem install rake -v 10.1.0
This situation really frustration, because simple rake works, but with bundle exec doesn't want.
I need execute rake with bundle exec
Really need your help!
I had the same issue, with exactly the same error message, with the same Ruby version yesterday. I solved it by removing this line from .bundle/config in my repository:
BUNDLE_DISABLE_SHARED_GEMS: '1'
I have the same problem and my solution was:
Delete my gemfile.lock
rm Gemfile.lock
donwgrade rake in my gemfile
gem 'rake', '10.0.2'
finally
bundle install
I had this problem with an AWS instance, managed by OpsWorks. I was logged in as ec2user. I switched over to the deploy user via sudo su - deploy and ran the bundle command again and it completed without error
I got a similar error when I tried running 'bundle exec $EXECUTABLE' without running 'bundle install' first :|

Bundle install failing on production server

I am trying to get a rails app up in production. I have uploaded it to the server, and ssh'ed into it without a problem. When I try to run: rake db:migrate RAILS_ENV=production, I get the following error:
Could not find rake-10.0.4 in any of the sources
Run `bundle install` to install missing gems.
So, I run bundle install and get the following error:
Gem::Exception: Cannot load gem at [/usr/local/lib/ruby/gems/1.9.1/cache/rake-10.0.4.gem] in /home/root/myapp
An error occurred while installing rake (10.0.4), and Bundler cannot continue.
Make sure that `gem install rake -v '10.0.4'` succeeds before bundling.
From here, I ran gem install rake -v '10.0.4' --no-rdoc --no-ri, and it succeeded:
Yet still, bundle install fails with the same error. What can I do to fix this?
Thanks for all the help guys!
I ended up redeploying after running bundle package, and then ran bundle install --deployment on the server, and now it works.
It looks like I/bundle needed to be more explicit about where to look for the gem files :)
Bundler will try to run Rake that is in your gemfile. You need to run bundle exec rake db:migrate RAILS_ENV=production
Obviously your installation is faulty. I suggest you re-do it from scratch, and if you'd like you better use rbenv
Please check this answer Install Ruby on Rails on Ubuntu 12.04 LTS
my suggestion will you please try. if you are not root user and running this rake commmad may be it will give error. why not you try to login as root user and then place and navigate to your code. home/root/myapp to var/yourfolder/yourapp then. check which version or ruby you are using ruby -v it should be 1.9 or above and the same for rails which version of rails you are using.

Resources