Closed zw963 closed 4 years ago
Hi, if you open a new instance of emacs, without activating any RVMs, then activate it for this project, does it work?
Does it work without the gemset?
Hi, if you open a new instance of emacs, without activating any RVMs, then activate it for this project, does it work?
Not working.
Does it work without the gemset?
No, it use default global gemset.
(require 'rvm), and then (rvm-activate-corresponding-ruby) in emacs.
After this is ran what do the following expressions output:
(rvm/info "ruby-2.6.3@rspec-example2")
(getenv "BUNDLE_PATH")
(getenv "GEM_HOME")
(getenv "GEM_PATH")
It working.
Can you elaborate on what is "working" how you know it's working?
Try run rspec again with following command, failed... bundle exec rspec --format documentation /home/zw963/Project/rspec_example/spec
When you run bundle exec
you're providing the path to your project. What directory are you in when you run bundle exec rspec
? Does this directory contain a .ruby-version
?
What does (shell-command)
echo $GEM_HOME $GEM_PATH $BUNDLE_PATH
show?
~/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:86:in `block in materialize': Could not find diff-lcs-1.4.4 in any of the sources (Bundler::GemNotFound)
Yes, it appears as though the gemset path is gone.
it caused by the BUNDLE_PATH was set by rvm.el, For current case, it set to /home/zw963/others/.rvm/gems/ruby-2.6.3@rspec_example2
This is a correct value.
Could it be that you're running ruby
version 2.6.0 whereas previously in the console you ran ruby
version 2.6.3?
Updated added note about 2.6.0 vs 2.6.3 ruby difference
After this is ran what do the following expressions output:
(getenv "BUNDLE_PATH") => "/home/zw963/.rvm/gems/ruby-2.7.1@respec_example2" (getenv "GEM_HOME") => "/home/zw963/.rvm/gems/ruby-2.7.1@respec_example2" (getenv "GEM_PATH") => "/home/zw963/.rvm/gems/ruby-2.7.1@respec_example2:/home/zw963/.rvm/gems/ruby-2.7.1@global"
Can you elaborate on what is "working" how you know it's working?
I create a new gemset, e.g. 2.7.1@rspec_example2
run bundle install success
start a new emacs process on current folder. e.g. emacs spec/test_spec.rb
run (rvm-activate-corresponding-ruby), and ensure it return expected ruby/gemset version in minibuffer.
run shell-command
in minibuffer, and send the command: bundle list
i expected it return expected bundle list result, but now, it told me, "Could not find diff-lcs-1.4.4 in any of the sources"
the only way is: run bundle install
again in emacs shell-command
, it will install all gems into another place, again. i consider this step is not necessary anyway.
When you run bundle exec you're providing the path to your project. What directory are you in when you run bundle exec rspec? Does this directory contain a .ruby-version?
In fact, i think it same as run this command within shell-command
.
What does (shell-command) echo $GEM_HOME $GEM_PATH $BUNDLE_PATH show?
echo $GEM_HOME # => /home/zw963/.rvm/gems/ruby-2.7.1@respec_example2 echo $GEM_PATH # => /home/zw963/.rvm/gems/ruby-2.7.1@respec_example2:/home/zw963/.rvm/gems/ruby-2.7.1@global echo $BUNDLE_PATH # => /home/zw963/.rvm/gems/ruby-2.7.1@respec_example2
This is a correct value.
In fact, when i run bundle install
from terminal first time, the $BUNDLE_PATH
environment variable was not set.
But, when i ran it in (shell-command)
, rvm set it, i guess this cause double gem install process.
May i do some things wrong for RVM install?
I've met the same issue. The solution for me was to unset BUNDLE_PATH
var completely. To make sure the reason was in that var I used the same steps as @zw963 described, but on step 5 instead of
- run shell-command in minibuffer, and send the command: bundle list
I did
- run shell-command in minibuffer, and send the command: unset BUNDLE_PATH && bundle list
And everything went fine, I got a proper list of gems.
So I've just deleted lines 410 and 414 in rvm.el
and recompiled it. Now everything works fine for me.
Idk if that an acceptable fix though. Maybe someone uses BUNDLE_PATH
in some setups.
Wow, this issue made my day. I’ve always suffer from various strange bugs related to paths, even if GEM_HOME and GEM_PATH seems right. I never saw before that I’ve no BUNDLE_PATH var in my console and that theses bugs seems to come from this weird bundle_path var.
I’ll push asap a fix for this, by adding a smarter BUNDLE_PATH var discovering.
Fixed by #61
because i run command mostly from konsole directly, so, use rvm.el not so often, if this is my use something wrong, please point out, thank you.
Following is reproduce:
Context:
assume i have a very simple ruby program, which only one gem(rspec) is in the the Gemfile, and a very simple spec, e.g.
expect(100).to eq 100
.create a new gemset
Run bundle install
Run spec on my terminal (konsole), it is working!
We assume it install some gems into rvm, following is a screenshot for that folder.
Notice: current on my console, no BUNDLE_PATH was set.
Initialize RVM, and set correct ruby and gemset in
.ruby-version
and.ruby-gemset
.(require 'rvm)
, and then(rvm-activate-corresponding-ruby)
in emacs.It working.
Try run rspec again with following command, failed.
Press M-!, run
(shell-command)
command, and yank following command.bundle exec rspec --format documentation /home/zw963/Project/rspec_example/spec
Then get following failing message:
But in fact, it there.
run
bundle install
again in(shell-command)
We can see same gems will be install once again, on another place,
it caused by the BUNDLE_PATH was set by rvm.el,
For current case, it set to
/home/zw963/others/.rvm/gems/ruby-2.6.3@rspec_example2
so, same gems was installed into $BUNDLE_PATH/ruby/2.6.0/ one more time.
Following is a diff screenshot.
How to fix
comment out following line, all work as expected.
https://github.com/senny/rvm.el/blob/master/rvm.el#L403