I'm trying to get Octopress (http://octopress.org/) working, but I'm having some issues.
I'm using POW (http://pow.cx/) and it seems to not load the correct Ruby version for me (using RVM).
It always uses the RVM default ruby version and not the one specified in .rvmrc. My default Ruby version in RVM is: ruby-1.9.3-p125.
In my .rvmrc file I have this: rvm use 1.9.2
I get this error in the browser when visiting my site:
LoadError: cannot load such file -- bundler/setup
~/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
~/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
~/Sites/Lejnus/lejnus/config.ru:1:in `block in <main>'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/builder.rb:4:in `instance_eval'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/builder.rb:4:in `initialize'
~/Sites/Lejnus/lejnus/config.ru:1:in `new'
~/Sites/Lejnus/lejnus/config.ru:1:in `<main>'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:50:in `eval'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:50:in `load_config'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:43:in `initialize'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:13:in `new'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:13:in `run'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/bin/nack_worker:4:in `<main>'
Why is it using 1.9.3-p125 when 1.9.2 is specified in my .rvmrc file? If I set 1.9.2 as default it works of course...
Isn't it supposed to do this magic for me and use the correct ruby versions?
Ok, seems like POW is moving away from RVM.
I needed to run this in my projects root to get it working:
rvm env . -- --env > .powenv
i've sorted the problem by adding a .powrc at the root of the project with the following code
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ]; then
source "$rvm_path/scripts/rvm"
source ".rvmrc"
fi
[Edited to add: This is recommended in the Pow documentation]
This is what solved the problem for me:
rvm env -- `rvm current` > .powenv
You can also create a rvm hook (as commented here) for switching the .powenv automatically when you change the current ruby env:
# ~/.rvm/hooks/after_use_update_powrc
for file in `ls ~/.pow/` ; do
POW_LINK_TARGET=`readlink ~/.pow/$file`
if [ `pwd` = $POW_LINK_TARGET ]; then
rvm env -- ``rvm current`` > .powenv
fi
done
Don't forget to make it executable:
chmod +x ~/.rvm/hooks/after_use_update_powrc
Related
We were using fastlane to run the CI work. Had to use AdService framework, and for that had to update Xcode. In order to do that, had to update macOS to Big Sur. After updating everything, gitlab CI stopped working:
$ bundle exec fastlane build
bundler: failed to load command: fastlane (/usr/local/bin/fastlane)
Bundler::GemNotFound: Could not find rake-13.0.3 in any of the sources
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/spec_set.rb:91:in `block in materialize'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/spec_set.rb:85:in `map!'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/spec_set.rb:85:in `materialize'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/definition.rb:170:in `specs'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/definition.rb:237:in `specs_for'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/definition.rb:226:in `requested_specs'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:108:in `block in definition_method'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:20:in `setup'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler.rb:107:in `setup'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/setup.rb:20:in `<top (required)>'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/Users/ci/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
So what I already tried:
in .bash_profile added:
export PATH="$HOME/.fastlane/bin:$PATH"
It did not helped. Tried :
sudo gem install fastlane -NV
That did not help either.
Also tried:
fastlane update_fastlane
And:
bundle install --path vendor/cache
Was trying to google for the solution, but unluckly can't fix that. I am an iOS dev, so this is something new to me.
Any ideas how this could be fixed?
Okey, so for the ones who are looking for a solution, after 2 days I finally found an issue. Was digging a lot, changing, installing, reinstalling etc. I thought of trying everything.
In my case, I use bash shell, so configured .bash_profile, added these lines of code:
export PATH="$HOME/.fastlane/bin:$PATH"
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
in .bashrcthere was some paths, that I commented out, and now there is only 1 line of code:
eval "$(rbenv init -)"
After doing that all works
P.S. if you are using zsh then files are different. Not 100% sure, but check .profile, .zshrc
Also I have edited gemfile.lock, as some gems were not as required, but not even sure if that was needed, as now I am not going to touch CI as it works :D
Hope that will save some time for someone in future. Else, if someone wants to add something, you are more then welcome (with some explanation would be even better, as not many of developers probably knows how all this crazy stuff works :) )
when I run this command on macOS Big Sur 11.2.3:
pod setup
shows this error:
$ pod setup ‹ruby-2.7.2›
Traceback (most recent call last):
12: from /Users/dolphin/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `<main>'
11: from /Users/dolphin/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `eval'
10: from /Users/dolphin/.rvm/gems/ruby-2.7.2/bin/pod:23:in `<main>'
9: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:304:in `activate_bin_path'
8: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:304:in `synchronize'
7: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:306:in `block in activate_bin_path'
6: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:243:in `finish_resolve'
5: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/request_set.rb:435:in `resolve_current'
4: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/request_set.rb:435:in `new'
3: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/resolver/set.rb:24:in `initialize'
2: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:42:in `require'
1: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:67:in `gem'
/Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:67:in `synchronize': deadlock; recursive locking (ThreadError)
(base)
I am searching from internet but did not found some useful imformation about this problem. I have tried to reinstall cocoapods still not fix this. what should I do to fix this problem? this is my ruby env:
~/source/cruise-open on main ⌚ 13:37:15
$ rvm list ‹ruby-2.7.2›
=* ruby-2.7.2 [ x86_64 ]
ruby-3.0.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
(base)
right now I found run pod install command still show this error.
Updating RubyGems did the trick for me.
https://guides.rubygems.org/command-reference/#gem-update
gem update --system
This error must be for any rails application. Check the ruby and rails version from the Gemfile. In my case, it's ruby 3.1.2 and rails 7.0.4.
Reinstall or Install the dependencies again. Ruby 3.1.2 is already there in my system but I reinstalled in order to fix this issue.
Remove the bundler from /.rvm/gems/ruby-3.1.2/cache
rm -rf bundler-2.3.25.gem
My Gemfile.lock was bundled with 2.3.25
And remove ruby from /.rvm/gems
rm -rf ruby-3.1.2
Now the error will be changed when you install rails or bundle to something
invalid gem: package is corrupt, exception while verifying: wrong number of arguments (given 2, expected 1) (ArgumentError) in /Users/anjanasingh/.rvm/gems/ruby-3.1.2/cache/concurrent-ruby-1.1.10.gem
Now, uninstall ruby using rvm(Yes, rvm works in my case though I used rbenv for setting the ruby versions)
rvm uninstall "ruby-3.1.2
Install ruby
rvm install "ruby-3.1.2"
bundle your application
bundle install
Rails is still not there. So, install rails
gem install rails -v 7.0.4
I have tried with 'rbenv install 3.1.2' and reinstall, installenter image description here multiple times but it was not working with rbenv. Finally rvm worked.
I'm using my work laptop to contribute to a non-work open-source project. At work we use rbenv to manage Ruby versions, but the open-source project appears to expect gem dependencies to be located in the system Ruby install folder. So when I try to run certain of the project's commands, I'm running into missing gem errors.
The project is Homebrew, and the command I'm running is brew style. When I run the command in my local, I get the following:
Ignoring rainbow-2.2.2 because its extensions are not built. Try: gem pristine rainbow --version 2.2.2
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rainbow (LoadError)
from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/richie.thomas/.gem/ruby/2.3.0/gems/rubocop-0.50.0/lib/rubocop.rb:4:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/richie.thomas/.gem/ruby/2.3.0/gems/rubocop-0.50.0/bin/rubocop:6:in `<top (required)>'
from /Users/richie.thomas/.gem/ruby/2.3.0/bin/rubocop:22:in `load'
from /Users/richie.thomas/.gem/ruby/2.3.0/bin/rubocop:22:in `<main>'
Running gem environment returns the following:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.10
- RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/richie.thomas/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/richie.thomas/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/richie.thomas/.rbenv/versions/2.3.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/richie.thomas/.rbenv/versions/2.3.3/bin
- SPEC CACHE DIRECTORY: /Users/richie.thomas/.gem/specs
....
I've been advised by other contributors that the easiest path forward would be to disable or uninstall rbenv in order to run the command. I'd really like to avoid uninstalling and reinstalling rbenv every time I want to run this command, but there is nothing in the rbenv documentation that mentions this.
Is there any one-time command I can run, or any configuration setting I can change, so that I can do what I need to do?
I re-ran gem environment and noticed that the following environment variables were defined:
INSTALLATION DIRECTORY: /Users/richie.thomas/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0
USER INSTALLATION DIRECTORY: /Users/richie.thomas/.gem/ruby/2.3.0
The value of INSTALLATION DIRECTORY is what I expected to be used to run the command, and I noticed the value of USER INSTALLATION DIRECTORY is what showed up in the error stacktrace.
Since I was unable to figure out how my machine was determining which variable to use, I simply renamed ~/.gem/ to ~/.gem2/ and re-ran the brew style command I originally wanted. This was successful!
I'm trying to install an application on Ubuntu that uses ruby. I installed RVM and Ruby 2.0 and ran rake install, but Rake tried using an older system version of Ruby. So I uninstalled the system version and tried running Rake again. This time it said "No such file". How do I get Rake to use RVM's ruby? Below is the output from different commands.
$ rake install
sudo bundle --without production staging test levelbuilder --quiet
sudo: unable to execute /usr/local/bin/bundle: No such file or directory
rake aborted!
...
/home/ubuntu/../rake_utils.rb:33:in `system'
..
/home/ubuntu/../rake_utils.rb:43:in `bundle_install'
/home/ubuntu/../Rakefile:198:in `block (3 levels) in <top (required)>'
..
/home/ubuntu/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `eval'
...
The path and version look right:
$ echo $PATH
/home/ubuntu/.rvm/gems/ruby-2.0.0-p643/bin:/home/ubuntu/.rvm/gems/ruby-2.0.0-p643#global/bin:/home/ubuntu/.rvm/rubies/ruby-2.0.0-p643/bin:/home/ubuntu/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ ruby -v
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]
$ which ruby
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p643/bin/ruby
Here's my .bash_profile:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
and here's the bottom of .bashrc:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting.
Execute source ~/.bash_profile
I have a feeling this has to do with rvm no longer using an .rvmrc file:
SystemExit: exit
/Library/Ruby/Gems/1.8/gems/bundler-0.9.26/lib/bundler/setup.rb:16:in `exit'
/Library/Ruby/Gems/1.8/gems/bundler-0.9.26/lib/bundler/setup.rb:16
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_requir e.rb:36:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
Now rvm uses two files instead of .rvmrc:
.ruby-version
.ruby-gemset
I don't know that Pow knows how to use those files. Because those files above that are getting used are from the global gemset, which tells me that my gemset isn't getting picked up.
You can still use .rvmrc if you like, it will take precedence over the two new rvm .dotfiles.