Bundle install failing on production server - ruby-on-rails

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.

Related

Why does my rails not run?

When I run $ rails -server to start a server, there comes an error:
Could not find gem 'sqlite3' in any of the gem sources listed in your Gemfile or available on this machine.
Does that mean I did not install sqlite3? How can I resolve the issue?
First, you have to install all Gems from your Gemfile.
This can be done with bundle install or in short bundle.
If this command executed successfully, you can run your server with rails s.
But I think it's better for you, to start with a tutorial.
server and s are not a switch, but a sub-command.
Run
$ rails server
or
$ rails s
I run into this issue previously, that is because you run bundle install, miss some gems, so you can $ bundle install again,
and you can test the sqlite if is installed:
$ sqlite3 --version
If successed, you can test the rails server.

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 :|

Ruby on rails error when running rails s

Um quite new to rails and um getting an error when run the command
rails s
it says
Could not find rake-0.9.2.2 in any of the sources
Run bundle install to install missing gems.
when I run bundle install nothing happened
my gem list has rake 0.9.2.2
what can go wrong?
my ruby version is 1.9.3
Thank you in advance
Remove all the versions of Rake ==> gem uninstall rake
Remove your gemfile.lock => rm Gemfile.lock
Remove gem 'rake' on your gemfile
Run bundle install
Install Rake manually : gem install rake --version=10.0.4
When you use command gem list, you will get a list of gem installed on your machine.
For example : rake (10.0.4, 10.0.3, 0.9.2.2)
Just see the console which gem is compatible with your application. It is already mentioned in the error log message.
Use
gem uninstall rake
Keep the suitable one and remove the version who is creating trouble. And then run rails s or bundle exec rails s
Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.3.]

missing paperclip when i am run server

I have problem with paperclip
sudo rails server
Could not find paperclip-3.3.1 in any of the sources
Run `bundle install` to install missing gems.
But paperclip is intalled.
Thank you.
It may be installed, but not available to your gem, or an incompatible version. Run the following commands from your app root:
bundle install
bundle exec rails s

Can't install ffi gem, Rails fail

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.

Resources