Error on production with devise - ruby-on-rails

git://github.com/plataformatec/devise (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
I see this when i move my site on production. On my localhost it works fine .. whats going on with this devise?
my gem file:
gem 'devise', git: 'git://github.com/plataformatec/devise'
and im using rails 4

What you need to do is run bundle install --deployment. What's happening is that your gems are being installed to the $HOME, and passenger is running as the nobody user, who has a different $HOME. Running --deployment installs the gems local to the application, so Passenger will find it.
This is answer from github and it works.

You are seeing this on production because apparently your production environment does not have the devise gem installed. If you are using heroku, make sure the gem is in the proper gem scope (not :development, :test) so that when the precompiler runs, it is installed. If you are using another environment, you should do exactly what the error says and bundle install it, so that the gem is installed to the production environment.

run bundle install locally. Then push again to production.

Related

You have already activated unicorn 5.2.0, but your Gemfile requires unicorn 5.3.0

I have an application running remotely, and I just upgraded rails to version 4.2.8, which upgraded other gems as well. I ran service unicorn restart afterwards, but the log for unicorn gives me this error:
You have already activated unicorn 5.2.0, but your Gemfile requires unicorn 5.3.0. Prepending bundle exec to your command may solve this. (Gem::LoadError)
I have tried gem uninstall unicorn -v 5.2.0, which returned successfully, and then gem install -v 5.3.0, which also returned successfully. Afterwards, I ran service unicorn restart, but the error persists.
I noticed the bundle exec suggestion, but I'm not sure what I should prepend this command to.
Try deleting your gemfile.lock file, and then running bundle install again, which will repopulate it from scratch, that normally sorts out my gem conflicts.
That means that the version of unicorn running on your machine is different than the version specified in your application. service unicorn is probably pointing to unicorn installed on the server/computer not pointing to your apps version of unicorn, right? Then when that starts your application, your app is trying to load a different version of the gem.
You could also run unicorn within the context of your app, like bundle exec unicorn - How to start rails server in production mode using unicorn and config file?.
If you have found a solution, good. If not, next time, create a new rails app using a unique gemset like 2.3.1#myapp.
This way, when you deploy to a remote server you will avoid this type of gems conflicts.
This could be caused by you having two different sources for gems on your machine.
If you use something like RVM with gemsets, make sure you are using the correct gemset. Especially, be sure that your gem install and gem uninstall act upon the application-sepcific gemset and not on the system-wide gems. You can find details at https://rvm.io/gemsets.
Bundler also generates a separate gemset per application. So if you use bundler, you have to run all your commands by prepending them with bundle exec (e.g. bundle exec rspec spec). If you want to remove gems from the bundle, remove it from your Gemfile and run bundle update gem_in_question afterwards (this will also update your Gemfile.lock). You can find more at http://bundler.io/v1.14/guides/using_bundler_in_application.html#executing-commands---bundle-exec.
I hope that this helps to solve your problem.

could not find a javascript runtime in rails and unable to instal ' therubyracer' gem - on windows

C:\sites\srhapp>rails generate controller home index
C:/Ruby21/lib/ruby/gems/2.1.0/gems/execjs-2.5.2/lib/execjs/runtimes.rb:48:in `au
todetect': Could not find a JavaScript runtime. See https://github.com/rails/exe
cjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
This are the error messages i get. kindly help me out .
Install nodejs. That may help here.
Follow this.
Now that you have Nodejs installed, see if any of these can help with the error you are getting (I was going to comment on jon snow's answer, but my suggestions became too long.):
Make sure you have C:\Windows\System32 in your system's PATH variable.
Close and then restart your command console.
Type node -v into the console. Does Nodejs respond?
Change the therubyracer line in your Gemfile to gem 'therubyracer', {:platforms => [:ruby]}. As far as I know, therubyracer isn't for Windows, but declaring it this way lets it still be used in Heroku if you plan on using that later. Run bundle install after you make this change.
Edit
Do you necessarily need Puma in your Windows development environment? If you only need it for deployment on Heroku, the easiest way that I have found to get around its difficulty with Windows is by putting it into the production group along with any other gems Heroku requires.
Gemfile
...
group( :production ) do
# Serves static assets in Heroku deployment.
gem 'rails_12factor'
# Web server for use with Heroku.
gem 'puma'
# Database used by Heroku.
gem 'pg'
end
...
That way, you can simply exclude those gems when you bundle install in your local development environment.
$ bundle install --without production
If you really do need Puma on a Windows environment, you will have to install OpenSSL libraries and headers (so I have heard; I haven't tried it myself). The comment by luislavena on this page should help you in that case.

bundle install can not be executed and causes error on rails production server

We use capistrano for rails deployment. Here is a strange error when running bundle install on production server.
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
If this is a development machine, remove the Gemfile freeze
by running `bundle install --no-deployment`.
You have added to the Gemfile:
* rails (= 3.1.3)
* mysql2 (>= 0.2.6)
You have deleted from the Gemfile:
* rails (~> 3.1.3)
Gemfile on production server was manually changed and then, this error comes out. This is a new production server and we plan to run rails 3.1.3. We rebooted the linux server and it did not help. Is there way to fix the problem? thanks so much.
I guess, you're using some deployment solution, like Capistrano. If this is the case, change the Gemfile on a development machine, run bundle install, commit everything into the repository and deploy again.
Don't ever change code manually on the server, it's gonna be bad for your karma.
Edit:
If you want to use some specific gems in production only, add them to production group.
# Gemfile
group :production do
gem 'mysql2'
end

ROR 3: working with environments and gems/bundler groups

Please could some one explain me how to work with different groups of gems in gemfile.
I've got the situaltion:
In my production enviroment i need some gems:
group :production do
gem 'pg'
end
and I DON'T NEED this gems to be installed on my dev machine.
But when I run in command line come commandes "rails g.." it tries to check gemfile and says
Could not find gem 'pg...
How this situation should be handled?
From http://devcenter.heroku.com/articles/rails31_heroku_cedar
therubyracer
If you were previously using therubyracer or therubyracer-heroku,
these gems are no longer required and strongly discouraged as these
gems use a very large amount of memory.
Well, it seems to be fixed after run "bundle install --without production"!!!

Rails 3 bundler & rvm: bundled gems don't show up in gem list?

ubuntu 10.04 slimy lynx or whatever it's called is the OS for a production app. I've installed rvm too, and other then being on a mac, the dev and production rubies and gems are the same.
Now, I'm used to seeing all of the bundled gems in gem list... like normal, however when i do gem list in production, I am not shown any bundled gems.
This means i can't use rails c or any other gem.
I've found out that i can do bundle exec rails c or something and use the console that way, but I'm more interested in why this is happening, and how to fix it so gem list has all the gems. it just feels right.
Thoughts?
When in development mode on your mac, the gems still get installed in the default gem path, whereas in production mode, they get installed in a folder specific to your project. Try doing a bundle show rails on each machine and you'll see what I mean.
When you run gem list it looks in the main gem folder, and since your production gems are sitting in a project-specific folder, the global gem command doesn't know to look there. So you will need to do a bundle exec to run any of those project-specific gemscommands on the server. For my purposes, I created a be alias to bundle exec. Also, to list your project's gems, you can do bundle list.
See http://gembundler.com/v1.3/rationale.html#deploying-your-application for the rationale behind this.

Resources