rails rbenv: rails: command not found

前端 未结 4 863
醉话见心
醉话见心 2020-12-24 08:46

I have recently moved from RVM to Rbenv and when attempting to execute rails I am getting an error like the one below

Pauls-Air:~ $ rails
rbenv: rails: comma         


        
4条回答
  •  独厮守ぢ
    2020-12-24 09:25

    I ran into the same issue, but none of these other solutions (or any of the others I found elsewhere) worked. I was about to go back to RVM, so I decided to get rid of rbenv completely and it paved the way to the solution.

    Try the following - it worked for me:

    1. uninstalling rbenv, remove all references rbenv in your bash profile, and remove the remaining rbenv file folder and its contents.

    2. Reinstall rbenv with homebrew.

    3. Add it back to your bash profile:

      export PATH="$HOME/.rbenv/bin:/usr/local/bin:$PATH"
      eval "$(rbenv init -)"
      
    4. Restart the shell:

      exec $SHELL -l
      
    5. Check the path:

      echo $PATH
      
    6. Install Rails:

      gem install rails
      
    7. rbenv rehash

    Note: I consulted this for part of this answer: https://www.codementor.io/tips/3732499178/solution-for-rbenv-rails-is-not-currently-installed-on-this-system-to-get-the-latest-version-simply-type

提交回复
热议问题