由于权限,Rails新应用程序失败

时间:2013-05-28 14:23:03

标签: ruby-on-rails ruby permissions gem

我已经搜索了一段时间,但无法解决问题。我在一台相对较新的计算机(osx)上,到目前为止只创建了一个rails应用程序。到现在为止一切顺利。我现在正在尝试使用

创建一个新的应用程序
rails new appname

这是终端告诉我的:

      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  lib/assets
      create  lib/assets/.gitkeep
      create  log
      create  log/.gitkeep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  test/fixtures
      create  test/fixtures/.gitkeep
      create  test/functional
      create  test/functional/.gitkeep
      create  test/integration
      create  test/integration/.gitkeep
      create  test/unit
      create  test/unit/.gitkeep
      create  test/performance/browsing_test.rb
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.gitkeep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
         run  bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.4) 
Using i18n (0.6.1) 
Using multi_json (1.7.4) 
Using activesupport (3.2.13) 
Using builder (3.0.4) 
Using activemodel (3.2.13) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.2) 
Installing tilt (1.4.1) 
Errno::EACCES: Permission denied - /Library/Ruby/Gems/1.8/build_info/tilt-1.4.1.info
An error occurred while installing tilt (1.4.1), and Bundler cannot continue.
Make sure that `gem install tilt -v '1.4.1'` succeeds before bundling.

当我进入

gem install tilt -v '1.4.1'

我得到以下内容:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/1.8 directory.

在搜索时,我发现人们看起来有类似错误,但我找不到解决我具体问题的方法。

我正在使用ruby 2.0.0和rails 2.3.13。

我真的卡住了,希望有人知道如何解决这个问题。提前谢谢!

更新:我注意到,当我运行rails new app命令时,终端会问我

Enter your password to install the bundled RubyGems to your system: 

之前从未这样做过。我有可能在系统上改变了一些东西吗?

Update2:使用2天以上,据我所知,解决方案是完全重新安装最新版本的ruby和rails。

3 个答案:

答案 0 :(得分:2)

尝试sudo 或者在您可以访问的目录中创建您的应用

答案 1 :(得分:1)

尝试sudo gem install tilt -v '1.4.1'

答案 2 :(得分:1)

如果sudo“gem install tilt -v'1.4.1'”不起作用。 然后大多数人都喜欢,“其他人”组在你的Ruby旅馆中没有正确的权限。 请确保您为group = others或运行该命令的用户提供了正确的权限:

  

/Library/Ruby/Gems/1.8