-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rbenv: rails: command not found #73
Comments
You need to |
I actually got the same problem today. I've got Rails installed for both my rails versions but I still get the following while running
Standing in my current project having a .rbenv-version file containing
I double checked to see if this is the right Ruby version by doing
Any ideas on the problem? |
I have the same issue with rspec. It's installed in 2 rubies but the 1.9.2 complains it doesn't exist and points me to the 1.8.7. If I gem install rspec and try again, same thing. |
Am having the same issue with the Rails binary. Gem is installed; running rails w/ bundle exec works fine. Running rbenv exec rails also works fine. Running just rails complains that the Rails gem is not installed and that I should sudo gem install rails to make it available. Other binaries (cap, rspec, cucumber) are all working fine w/out * exec help. |
I actually fixed this error by doing a manual install of rails |
Hmm...wonder why this issue is closed? I just did a dry install of rbenv/ruby-build (no previous rvm) and shims are not being created for Bundled gems. When I run back and do gem install gem name, everything works great. Is this something that we should hold on for the next version? |
This isn't an "issue". Bundler doesn't work this way. See bundlers |
how about integrating https://github.com/carsomyr/rbenv-bundler ? |
Sorry, but we're not adding anything bundler specific to rbenv. |
rbenv-bundler looks great -- but that's exactly why we have a plugin system in the first place. rbenv itself knows nothing about RubyGems or Bundler. |
I just did a fresh install of Lion. After installing rbenv, ruby and rails I am unable to run |
Not to keep things running but did you perform rbenv rehash? On Tue, Oct 4, 2011 at 12:56 PM, Michael Minton <
|
I did. Update: |
I had the same or similar issue...
Turns out I had something at |
@BlakeFrost: same for me, I've deleted that command too and everything just worked fine. |
Same issue for me. This should not be closed.
You can then rerun your "rails" command. |
@rebelwarrior put some context :-) $ rbenv versions |
@mauriziodemagnis I manage to fix the problem by sudo rm -rf /usr/bin/rails (and rake) and then reinstalling 1.9.3p0 with ruby_build again. Then closing the terminal and restarting it and it seems to work now. I need to test erb next since I didn't remove that one from /user/bin/ but I think the re-install fixed whatever issue I was having. FYI I have jruby installed (not on rbenv but normal). |
I'm having similar problems to those described in this thread. I think rbenv needs better install/convert-from-rvm instructions to explain how things do/should work. |
New install of rbenv and freshly built rubies. Set 1.9.3 to be my global ruby. Then tried:
If I open a fresh terminal, though, rails -v reports the correct version. What the heck is going on here? Any ideas? |
Same problem as many here. Tried all suggestions, no luck, mystified, then blew away versions directory ~/.rbenv/versions/, rbenv install 1.9.2-p290, gem install rails, rbenv rehash, success. |
The problem seems to be when installing rails with bundler. I have specified rails in my Gemfile and this is the result for me: bundle install
|
@espen That is the documented behavior of bundler. Gems installed by bundler don't put their binaries in the shared bin directory (i.e. gem's EXECUTABLE DIRECTORY). |
So what is the best way of handling this? Use a gemset so there will be only one rails gem? Use bundler --path DIR to pack gems locally and use bundle exec rails ? Does rbenv or any plugins offer a best practice solution for this? |
Having multiple rails gems installed isn't a problem. Rails will load the version specified in Gemfile.lock. Or you can |
I can use rails inside a rails project using bin/rails (because I use
But I don't seem to have a way to install the rails command outside of a rails project
|
Can't seem to fix this, tried all the methods here with no success, switching back to rvm, much easier to use |
Turns out you need to use rbenv exec to get the rails binary in the right spot: |
Thansk for the suggestion but it doesn work for me:
|
(I'm using zsh.) Instead of quitting your shell, run Edit: I can't repeat it, now
|
Had this problem. @veilleperso 's solution worked for me.
(then completely close terminal and reopen)
|
I had the same problem. Running 'rbenv rehash' fixed it |
People may be running into this as a result of a subtle environment differences between:
and
In my environment, the second approach updates the shims while the first does not... |
Some of you may have had this problem from not reloading your shell after installing. |
@veilleperso ftw, thank you! |
+1 for the solution of quitting terminal (iTerm2) and starting it again - works fine now |
For some of you… I had a .gem folder in my home… I rm'd it and problems went away. :-) |
I'm getting exactly the same problem. I've tried everything above but none have worked. Really disappointed as I'm loathed to go back to rvm. Seems to only be a problem if I create a sub-folder in a folder withinin my Sites directory. |
@Rosco77 Which rbenv version are you on? Check with |
It's a very weird scenario. The command "rails new myproject" works anywhere on my system as expected except when I try and run it when I'm in a child folder within the If I run rbenv version I get "2.0.0-p247 (set by /Users/rosco77/.rbenv/version)". If I run gem install rails it installs successfully and I get the following message "Successfully installed rails-4.0.1 I've run rbenv rehash but still get the same error message of "Could not locate Gemfile" when I try and run the command in that specifc folder. I've tried to delete the folder in question. Tried different names, etc, and it just doesn't work. I've checked my installation and this is the output I get when I run echo "/Users/rosco77/.rbenv/shims:/Users/rosco77/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin." I've attached an output of the results I get when I run "curl -s https://gist.github.com/mislav/4728286/raw/rbenv-doctor.sh | bash -x 2>&1". Any help you can give would be great. |
Your issue is probably caused by the
|
Many thanks @mislav that seems to have fixed it. 👍 |
gem install railties did the trick!gem install railties && rbenv rehash |
I had the same issue and the solutions above didn't fix my problem. This error came up for me after upgrading my global Ruby version to 2.2.2. After upgrading I had to run: rbenv shell 2.2.2 once I set that, I was then able to install bundler and then bundle in my app directory. Here is the stackoverflow post that helped me: http://stackoverflow.com/questions/17562426/installing-gems-to-which-ruby-with-rbenv |
@tmartyny You have to install Bundler for each Ruby version just intend to use it on. When you did for ver in `rbenv versions --bare`; do RBENV_VERSION=$ver gem i bundler; done |
First remove any previous docs of yaml by cd .rvm/src rvm pkg install libyaml P.S You will need to reinstall ruby after this. |
@FWOliver You seem to be using RVM, which is a different Ruby version manager than "rbenv", which is what we are discussing here. |
Hey - I am using zsh and was wondering why I am getting the following warning every time I launch terminal: Everything appears to be fine and I am using rbenv to manage my versions with the following export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
alias bex="bundle exec" |
It seems that |
Thanks @mislav . There is no Which ruby gives |
@abcbots Thank you, man! It helps. |
when i run chef-client with then i am getting this error even though i have installed 2.1.0 and 2.3.1 both ruby version using rbenv. The `bundle' command exists in these Ruby versions: |
I got the same issue with Intellij IDEA, all I did was to change the SDK to 2.3.3 from 2.4 |
gem install bundler |
you should copy part init rails from file
hope it useful :) |
Just in case. Working on Ubuntu 16.04 I added these lines to .profile, copied from .bashrc
|
How do you run gem executables without Bundler /
bundle exec
?Maybe related to #40, #61
The text was updated successfully, but these errors were encountered: