Rails is not using my global Ruby version

前端 未结 3 1621
执笔经年
执笔经年 2021-01-12 04:18

I want to use Rails with Ruby 2.1.0, but it\'s using Ruby 1.9.3 (the system\'s version).

I\'m using rbenv to manage my Ruby versions. My steps were something along t

相关标签:
3条回答
  • 2021-01-12 04:37

    Try creating a .ruby-version file in the root of your project with the following contents:

    2.1.0
    
    0 讨论(0)
  • 2021-01-12 04:40

    Sounds silly, but did you restart terminal session?

    Otherwise try and type

     /bin/bash --login
    
    0 讨论(0)
  • 2021-01-12 04:51

    You didn't tell how you installed rbenv, but I think it is per-user installation (which is default). In this case you should install gems without using sudo. When you did sudo gem install rails, it was installed in system ruby, not rbenv's selected one.

    Solution - install rails without sudo:

    rbenv global 2.1.0
    gem install rails
    rbenv rehash
    
    0 讨论(0)
提交回复
热议问题