问题创建新的Rails应用程序

时间:2015-10-07 15:03:25

标签: ruby-on-rails

当我使用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应用程序?

2 个答案:

答案 0 :(得分:0)

确保您的用户属于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.

答案 1 :(得分:0)

运行:

rails new test

无论如何都不适用于应用程序名称,因为它是一个保留的rails字。您可能希望使用类似testapp

的内容