Problems on running rails server - ruby-on-rails

I have tried to install gem draper and it asked me to update my activerecord to version 3.2.6. Done it I have installed succesfully draper but now when running my web application with rails server it gives me this error:
/var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in `block in setup': You have already activated multi_json 1.3.6
, but your Gemfile requires multi_json 1.3.5. Using bundle exec may solve this.
I use aptana studio 3
How to solve it?

Firstly, make sure you have run bundle update after changing your Gemfile.
Then you need to do what the error message says and use bundle exec, which uses the gems from your Gemfile.lock, rather than the gems installed on your server.
So run this:
bundle exec rails s

please try to run :
bundle install

Related

Rails - Cannot create New rails Application

I already have a live Rails application which is running in rails 5.0.1. Now, when I try to create new rails version I get the following error
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' I get the following error
Could not find spork-1.0.0rc4 in any of the sources
How can I solve this error?
My System only have Rails 5.0.1 version and Ruby version 2.3.1.
PS: When I keep Ruby version in 2.2.5, I am able to create my rails app successfully.
If you're trying to create a new rails application, try setting it up in a new folder.
If you're trying to update the rails version of your current project update the rails version in your Gemfile and run bundle update rails.
Prepending the command that's giving you
Could not find proper version of railties (4.2.7.1) in any of the sources
Run `bundle install` to install missing gems.
with bundle exec may solve your problem.
If you're using something like rbenv to manage your ruby version, you may have to update your .ruby-version file, and then run
rbenv install
gem install bundler
bundle install
to install that new version of ruby, bundler and your gems.

How to force rack to work around the usual "You have already activated rack..." bug?

This is a common question, but none of the answers seem to solve the issue. I get the usual: You have already activated rack 1.4.1, but your Gemfile requires rack 1.3.6. Using bundle exec may solve this.
Clearing the Gemlock file did nothing and running bundle install again did nothing...running bundle install --binstubs did not solve the issue as "run ./bin/{rake|rails|etc} from your app root" just caused more errors. Is there a way to get rack around this apparently common problem?
The problem is this:
You have (at least) two versions of Rack installed.
Your Gemfile calls for one version (1.3.6). Your current environment is providing another version (1.4.1).
By the time your application executes, the current environment has already loaded 1.4.1.
Bundler knows you need to load 1.3.6, but it can't load it. You may not load more than one version of the same gem, so the 1.4.1 version wins since it was loaded first.
Bundler complains to you.
Uninstall the problematic gems (e.g. gem uninstall rack -v 1.3.6). Even better, use RVM and gemsets to isolate your gems better and you won't encounter this issue.
I had the same issue while trying to deploy a production app. I'm using rbenv to manage my ruby environments unicorn installed by default into rbenv. The gem dependencies listed in the Gemfile are being installed by bundler. It happens this was causing the issue.
The workaround I did was to uninstall unicorn from rbenv's environment and install it through the Gemfile. After all, I think this approach is more clean and straightforward.
If you are using RVM, the issue happens if you define a gem in the global environment that depends on rack the same way unicorn does and then define a per-project gemset. I think this is because of the dependencies of rails 3.1 (I'm not sure though). The solution is to uninstall unicorn (or the gem that installs rack 1.4.1) from global gemset and install it in a per-project gemset.
If you are using bundler and RVM you have two options:
- create a gemset with rails and the gem that installs rack 1.4.1 (best suitable for dev workstations)
- put the gem that depends on rack 1.4.1 in the Gemfile and let the bundler to the magic.
This problem is also common when you clone the project from a repository (ejem. github), because it might have the Gemsfile.lock already. So the gems it has might be different than the ones your enviroment has already loaded. So, firts get a backup of your Gemsfile.lock, then remove it and run bundle install --without production .It will install all your dependecies according with the GemFile. Be aware that if the application is old it might not work with the environment on your machine.
If the same error message concerning Spring brought you here, i.e. you're getting a message similar to this one:
You have already activated spring 1.4.0, but your Gemfile requires spring 1.3.6.
The solution is the same as the accepted answer:
gem uninstall spring -v 1.4.0
Sometimes all you need to do is just install the gem.
I had this problem on openshift and gone to the project dir:
$ rhc ssh APP_NAME
$ cd app-root
$ gem install GEM_NAME
after that the app started normally.
Open Gemfile.lock, find the entry for rack (1.3.6) and delete it.

Gem 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"]"

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?

How do I resolve a ZenTest-4.6.2 successfully installed & missing gem?

I'm loosely going through http://ruby.railstutorial.org/chapters/ and am at the point of preparing to test http://ruby.railstutorial.org/chapters/static-pages#sec:testing_tools . I listed the autotest related gems in my Gemfile and ran bundle install without incident, but when I tried to start the server I got the error Could not find ZenTest-4.6.2 in any of the sources. So I added ZenTest 4.6.2 to my Gemfile and reran bundle install.
Now according to my bash terminal, my bundle is complete including Using ZenTest (4.6.2), but when I try to start my server I'm still getting the error Could not find ZenTest-4.6.2 in any of the sources. So is it installed or is it not installed? And how should I resolve this conflict?
It should just say: gem "ZenTest" in your gem file, not the version # as well.

undefined method `call' for :err:Symbol after bundle update

After pulling my application, I noticed I had to run bundle install (I'm using rails 3 and ruby 1.9 at Ubuntu 10.10).
Bundler indicated a gem conflict and told me to bundle update. After that, my application broke giving me the following error:
https://gist.github.com/979975
At config/environment.rb:5, I only have
TopTal::Application.initialize!
I reinstalled rvm, ruby, ran bundle install again but the error still appears here. Does anyone have any idea?
Be careful with "bundle update"! When you ran it, bundler ignored the previously installed gems in Gemfile.lock and updated many or all of your gems. I suggest you revert your Gemfile and Gemfile.lock back to before you did the update and try bundle install again. Note the gem with the conflict and then do "bundle update gem_name". This should update only the gem with the problem.

Resources