I have a rails project. I run command rails server and rails console, but both give me this error:
So, I ran the command sudo gem install polyglot. It successfully installed polyglot-0.3.5, but the same error still persists. I am wondering what the problem is. Is there anything wrong in my Gemfile?
My Rails version is "Rails 5.0.0.1" and my Ruby version is "ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]".
You should add in Gemfile this line gem 'polyglot' , then run bundle install. It will be better to add gem locally in Gemfile instead globally through gem install.
Related
I need some help with this setup on ruby on rails:
ruby version 2.7.1
ruby on rails version 6.0.3.3
In my application gemfile I have:
gem 'postgres'
gem 'pg', '~> 0.19.0'
But, when I run 'bundle install' and I will try to run the server, the following message appears:
This is an old, deprecated version of the Ruby PostgreSQL driver that hasn't
been maintained or supported since early 2008.
try to install using command gem 'pg' without specifying the version.
I'm trying to install Redmine 2.3 from SVN (http://redmine.rubyforge.org/svn/branches/2.3-stable/)
I am using this tutorial (http://www.redmine.org/projects/redmine/wiki/HowToInstallRedmineOnUbuntuServer) as Ruby is not really my piece of cake....
I'm getting an error when running a command: rake generate_session_store
Could not find gem 'rails (= 2.3.14)' in any of the gem sources listed in your Gemfile.
Run bundle install to install missing gems.
I installed rails, but I still get the same error... searched for answers but this is really driving me crazy now.
:/usr/share/redmine# rails -v
Rails 2.3.14
Could anyone with more experience shed some light on it?
Run to install all dependent gems bundle install
run
bundle exec rake generate_session_store
this will call rake in scope of current installed gems.
In Redmine 2.x you have to use
rake generate_secret_token
Instead of the old (which is for Redmine 1.4.x)
rake generate_session_store
Source: http://www.redmine.org/projects/redmine/wiki/RedmineInstall
I'm not a rubyist and there might be something obvious I'm missing.
I've wrote an application in Ruby 1.8.7, I'm trying to package it in Vagrant (running Raring 13.04), but I've to run "bundle install" to install the requirements and even though gem1.8 does exist, running bundle install still install the gems for Ruby 1.9.3. And then my program fails at runtime...
Any idea about how to solve this?
UPDATE 1
The related Gemfile (thanks to the first answerers):
ruby '1.8.7'
# ...
gem 'trollop'
but for ruby1.8 myfile.rb an error is raised
no such file to load -- trollop (LoadError)
After investigation, the problem looks in bundle install:
Your Ruby version is 1.9.3, but your Gemfile specified 1.8.7
I don't get how to solve the problem.
UPDATE 2
After following the advices from #klaffenboeck things have changed. I'm using RVM and have Ruby 1.8.7 when entering in the project folder. Bundler seems to install things correctly, however the require seems to fail... Path problem?
See here for detail about Vagrant / RVM setup: https://rvm.io/integration/vagrant
UPDATE 3
Problem solved, I was missing a:
require 'rubygems'
before all gems (it worked locally but not in Vagrant).
Bundler will install gems (by default) for whichever Ruby is in your PATH.
Try /usr/bin/env ruby -v or which ruby to figure out which one that is; my guess is you're running bundler with Ruby 1.8.
Adding
ruby '1.8.7'
on top of your Gemfile will help diagnose.
Not aware of this problem in general, but try to put the ruby-version at the top of your gemfile:
#Gemfile
ruby '1.8.7'
# followed by your gems
Edit:
this is most likely because your Gemfile.lock states ruby 1.9.3 - run bundle update
Try running gem uninstall bundler, then gem1.8 install bundler.
Your bundle command seems to be running under Ruby 1.9.3. You can verify which ruby executable bundler is using with head -n 1 $(which bundle). You want it to be ruby1.8.
I'm just upgrading a Rails app to Ruby 2.0.0, deploy to Heroku works fine. ruby "2.0.0" is specified in the Gemfile, but when I try to start Rails locally using
bundle exec foreman start
I get...
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
I've installed the latest Bundler, done a bundle instal and I've gor rvm running ruby 2.0.0.
ruby -v in the console returns ruby 2.0.0p0
I'm just not sure where this is falling down.
Running foreman start works as expected. It just wont start with bundle exec
Can anyone point me in the right direction? What am I missing?
I ended up including the foreman gem in the app's Gemfile. This works, but since the Gem is deprecated, it's really just a workaround.
I am working on ubuntu and rvm. In any case I tried to use sudo gem (any command) it does not recognize gem as command. In addition if I use gem seperately as:
gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: Possible alternatives: rails
I got that error. I cannot see the reason.
rvm version 1.10.3
ruby version 1.8.7
gem version 1.6.7
What is the possible reason behind this?
Re-install all rvm and ruby and the gems, solved my problem.