无法在全新安装的Rails上创建新应用

时间:2012-03-15 03:37:31

标签: ruby-on-rails ruby ruby-on-rails-3

我正在尝试在新安装的Rails上创建一个新的应用程序,它给了我一个'权限被拒绝',然后很多其他的东西,然后才开始工作。

我试图寻找答案,但似乎根本找不到容易找到的答案。这就是我的终端的样子:

    Zach-Beckers-Computer:rails_projects Zach$ rails new first_app
      create  
/Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': Permission denied - /rails_projects/first_app (Errno::EACCES)
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:205:in `each'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:51:in `block in invoke!'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `call'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `invoke_with_conflict_check'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:50:in `invoke!'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/actions.rb:95:in `action'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:15:in `empty_directory'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/railties-3.2.2/lib/rails/generators/app_base.rb:103:in `create_root'
    from (eval):1:in `create_root'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/railties-3.2.2/lib/rails/commands/application.rb:38:in `<top (required)>'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/railties-3.2.2/lib/rails/cli.rb:15:in `<top (required)>'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/Zach/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/railties-3.2.2/bin/rails:7:in `<top (required)>'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/bin/rails:19:in `load'
    from /Users/Zach/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/bin/rails:19:in `<main>'

我不知道我需要什么或我需要做什么。我应该提一下,我在一台1岁的Macbook pro上运行OSX Lion(10.7)。

2 个答案:

答案 0 :(得分:10)

当您应该在“home”目录中时,您似乎正尝试在根目录中创建rails应用程序。在OS X中,它是/ Users / Zach。这样做:

cd ~/
mkdir rails_projects
cd rails_projects
rails new first_app

答案 1 :(得分:1)

您对尝试创建Rails应用程序的目录没有写入权限。确保该目录属于具有chown的用户,并确保您使用chmod对该目录具有写入权限。