I'm having a really strange issue. On my remote server (which is a Max OSX Server), I have Ruby 1.9.3 installed via RVM. When I type ruby -v, I get
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.3.0]
When I type in which bundle, I get
/Users/moby/.rvm/gems/ruby-1.9.3-p448/bin/bundle
And if I do bundle install in my Rails project, it succeeds without any errors.
However, when I try with Capistrano via cap deploy:cold on my local machine, which SSH's into the remote machine, deployment fails with the following error:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in
`report_activate_error': Could not find RubyGem bundler (>= 0)
(Gem::LoadError)
Why is it using Ruby 1.8? How do I get it to use Ruby 1.9.3 instead?
I was able to solve the issue by doing the following:
SSH into your remote server, and print out the following values:
$PATH
$RUBY_VERSION
$GEM_HOME
$GEM_PATH
$BUNDLE_PATH
Add the following entry into the deploy.rb file, setting the values of each key to the respective outputs from above:
set :default_environment, {
'PATH' => "/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448/bin:/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448#global/bin:/Users/USERNAME/.rvm/rubies/ruby-1.9.3-p448/bin:/Users/USERNAME/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/usr/local/git/bin",
"RUBY_VERSION" => "ruby 1.9.3",
"GEM_HOME" => "/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448",
"GEM_PATH" => "/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448:/Users/OraServer1Admin/.rvm/gems/ruby-1.9.3-p448#global",
"BUNDLE_PATH" => "/Users/USERNAME/.rvm/gems/ruby-1.9.3-p448/bin/bundle"
}
sudo update-alternatives --config gem
and select the right version
Related
/gems/htmlentities-4.3.2/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot"
/gems/ruby-2.2.0/gems/fog-core-1.25.0/lib/fog/core/collection.rb:144: warning: circular argument reference - filters
The obvious suspicion is that these gems don't like ruby 2.2.0, but things seem to be working
Should I fear future, imminent failures, or has these gems just haven't caught up yet?
Both problems were solved in newer versions of these gems.
If I am depending on gems like that, I usually wait a little bit before switching the project to the latest and greatest ruby in production. Gems need time to get compatible with all the changes.
I to have like this error when install redmine 3.2:
/usr/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
All is simple - just edit this file and remove duplicated line!)
But sometimes need just check your htmlentities version and remove not needed
gem list htmlentities
gem uninstall htmlentities -v '4.x.x'
My System Config: Win 8.1 + SQL 2016 Expr SP1 + Redmine DB (type SQL 2012 CS AI) + Redmine 3.3.1 + Ruby 2.3.3 + devkit + ImageMagick-6.9.6-8-Q16-HDRI-x64-dll (ImageMagick-7.0.3 Not working!)
Fix issue with htmlentities-4.3.1 "key inodot"
gem install htmlentities -v '4.3.4'
gem uninstall htmlentities -v '4.3.1'
Fix issue with error load "tiny_tds"
gem install tiny_tds -v '1.0.5'
gem uninstall tiny_tds -v '0.6.2'
Change all dependencies in Gemfile & Gemfile.lock from old version to new installed.
All other commands from Installing Redmine Guide Site.
Result:
c:\inetpub\redmine>bundle exec rake db:migrate
migrating
add_column(:roles, :settings, :text)
-> 0.0019s
-> -1 rows
AddRolesSettings: migrated (0.0027s)
c:\inetpub\redmine>set REDMINE_LANG=ru
c:\inetpub\redmine>bundle exec rake redmine:load_default_data
Default configuration data loaded.
c:\inetpub\redmine>bundle exec rails server webrick -e production
=> Booting WEBrick
=> Rails 4.2.7.1 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2016-12-13 15:14:25] INFO WEBrick 1.3.1
[2016-12-13 15:14:25] INFO ruby 2.3.3 (2016-11-21) [x64-mingw32]
[2016-12-13 15:14:25] INFO WEBrick::HTTPServer#start: pid=4468 port=3000
[2016-12-13 16:02:58] INFO going to shutdown ...
[2016-12-13 16:02:58] INFO WEBrick::HTTPServer#start done.
Exiting`enter code here`
gem uninstall htmlentities -v '4.3.2'
gem install htmlentities -v '4.3.4'
I have a Sinatra app that I continually upgrade (local only, at the moment). Problem being that I know nothing at all about Ruby — my friend made me the app and it's worked beautifully for over almost a year.
To see the site on localhost, I do this:
bundle exec unicorn -l 9000
I don't understand this, haven't needed to. I know I'm using the unicorn gem to run the app directed at port 9000 (due to an old printer conflict).
Today, I get this error:
in `evaluate': compile error (SyntaxError)
syntax error, unexpected ':', expecting $end
which refers to line 16 of my gem file, the sinatra-contrib gem:
gem "sinatra-contrib", require: "sinatra/reloader"
I've never had this error before. Haven't ever touched the gem file, and it's been working for a year. The only thing I can think I've done recently that may have affected my environment is installing a gemset called Wordless:
rvm use 1.8.7#wordless --create --default && gem install therubyracer sprockets compass coffee-script thor yui-compressor && rvm wrapper 1.8.7#wordless wordless compass ruby
I'd appreciate insights, and hopefully I can start to learn a thing or two about managing ruby gems. Thanks.
You were using Ruby 1.9 before. The line you referenced is in 1.9 format, which Ruby 1.8 does not understand.
When you installed Wordless you said:
rvm use 1.8.7#wordless --create --default
This made Ruby 1.8.7 your default interpreter. To switch back to whatever you used before do:
rvm list rubies
And then:
rvm use [the 1.9.x you found in the list above] --default
I am now setting up my Redmine 2.1.0 in Debian. When I ran this RAILS_ENV=production rake db:migrate in Redmine directory. It's showing an error like this
rake aborted!
Invalid preference factor: 3.0
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
My Ruby version is 1.8.7
When I gave this command "ruby -e 'p 0.3". it prints 3.0. I don't know what the issue was. How can I set up Redmine 2.1.0 in my organization?
Seems you have an issue with your specific ruby.
rvm is your friend. Try installing 1.9.3-head, create gemset for redmine and proceed installation.
Big advantage of RVM approach is a fact that new rubies install does not affect system ruby no applications using it.
I am on a VM (Lucid 64b) with a system Ruby version of 1.9.3p0.
I have a Ruby script that creates a .deb file -- The script needs to use Ruby 1.8.7 which I have installed in /foo/ruby/1.8.7.
There is an existing Gemfile to be used with Bundler
I can't use RVM and I can't install gems at the system level.
My .bashrc includes (and has been sourced)
export PATH=$PATH:/foo/ruby/1.8.7/bin
but ruby -v still gives me
ruby 1.9.3p0 (2011-10-30) [x86_64-linux]
Questions
How can I change the Ruby version for my user to use Ruby 1.8.7?
I've run: bundle install --path vendor/bundle
So in that directory (actually ./vendor/bundle/ruby/1.8/cache/gems) are all the gems I need but, when I run the Ruby script it doesn't find the required gems. I run the script like so /foo/ruby/1.8.7 script_to_gen_deb_file.rb
How can I get ruby to see/use the bundled gems?
Update
I was able to solve it. I needed to use
/foo/ruby1.8.7/bundle exec /foo/ruby1.8.7/ruby script_to_gen_deb_file.rb
I had tried this before, but I got an unrelated error and believed there was an environment problem.
Change your path so the special ruby gets precedence?
export PATH=/foo/ruby/1.8.7/bin:$PATH
I'm running ruby 1.9.2 on Windows and am trying to port code that worked in Ruby 1.8. The code uses Open4.popen4 which previously worked fine. With 1.9.2 I have done the following:
Installed POpen4 via gem install POpen4
Required POpen4 via require 'popen4'
Attempted to use POpen4 like:
Open4.popen4("cmd") {|io_in,io_out,io_er| ... }
When I do, I get the error:
no such file to load -- win32/open3
If I try and install win32-open3 (gem install win32-open3) I get the error:
win32-open3 requires Ruby version < 1.9.0
Does anyone know how I get around this problem?
Haven't used it, but this might work: https://github.com/matschaffer/win32-open3-19
Adding
gem "win32-open3-19", :platforms => :mingw, :git => "github.com/matschaffer/win32-open3-19.git"
to my Gemfile didn't exactly work.
Here are the steps that solved this for me:
Add this to the Gemfile -> gem 'win32-open3-19', :platforms => :mingw
Run bundle to install win32-open3-19
That was it. For me the git location was unncessary and didn't work.