【问题标题】:Issue creating new Rails App创建新的 Rails 应用程序时出现问题
【发布时间】:2016-01-04 21:29:27
【问题描述】:

当我使用 rails new Test 创建一个新的 rails 应用程序时,我收到以下错误。

run  bundle install


Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:

bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.

我有 rbenv -v rbenv 0.4.0 和 rails -v Rails 4.2.4

如何解决这个问题,以便创建一个没有这个问题的新 Rails 应用程序?

【问题讨论】:

标签: ruby-on-rails


【解决方案1】:

运行

bundle install --path=vendor/bundle

这会将 Gems 安装在项目的 vendor/bundle 目录与系统 gems 目录中。这是一个很好的方法,可以让你的 gem 在应用程序之间隔离,而不是污染你的系统 gem。只是我的 2 美分。

【讨论】:

    【解决方案2】:

    确保您的用户属于 RVM 组

    sudo usermod -a -G rvm myUserName

    Run gem env. You should see a list of paths like so under GEM PATHS:
    
    /Library/Ruby/Gems/2.0.0
    
    /Users/sam/.gem/ruby/2.0.0
    
    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
    
    Open your ~/.bashrc file and add the paths as follows:
    
    export GEM_HOME=/Library/Ruby/Gems/2.0.0
    
    export PATH=$PATH:$GEM_HOME:/Users/sam/.gem/ruby/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
    
    Open a new shell and run the gem install rubygems-update.
    
     Everything should run fine now without sudo.
    

    【讨论】:

      【解决方案3】:

      跑步:

      rails new test
      

      无论如何都不适用于应用程序名称,因为它是一个保留的 rails 字。你会想要像testapp这样的东西

      【讨论】:

        猜你喜欢
        • 2016-11-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-06-01
        • 1970-01-01
        • 2019-12-29
        • 2020-07-28
        相关资源
        最近更新 更多