不能在新安装的Rails上创建一个新的应用程序吗

时间:2021-10-01 23:06:30

I'm attempting to create a new app on a fresh install of Rails and it gives me a 'permission denied' and then a lot of other stuff before just not working at all.

我正在尝试在一个全新的Rails安装上创建一个新的应用程序,它会给我一个“被拒绝”的许可,然后还有很多其他的东西,然后才会完全停止工作。

I've tried to look for an answer but it there doesn't seem to be an easy to find answer at all. This is what my Terminal looks like:

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

    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>'

I don't know what I need or what I need to do. I should mention I'm running OSX Lion (10.7) on a Macbook pro that is 1 year old.

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

2 个解决方案

#1


10  

It looks like you're trying to create a rails app in your root directory when you should be in your "home" directory. In OS X that'd be /Users/Zach. Do this:

当您应该位于“home”目录时,看起来您正在尝试在根目录中创建一个rails应用程序。在OS X中是/用户/Zach。这样做:

cd ~/
mkdir rails_projects
cd rails_projects
rails new first_app

#2


1  

You don't have write access into the directory you're trying to create your Rails app. Make sure the directory belongs to your user with chown and make sure you have write permissions into that directory with chmod.

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

#1


10  

It looks like you're trying to create a rails app in your root directory when you should be in your "home" directory. In OS X that'd be /Users/Zach. Do this:

当您应该位于“home”目录时,看起来您正在尝试在根目录中创建一个rails应用程序。在OS X中是/用户/Zach。这样做:

cd ~/
mkdir rails_projects
cd rails_projects
rails new first_app

#2


1  

You don't have write access into the directory you're trying to create your Rails app. Make sure the directory belongs to your user with chown and make sure you have write permissions into that directory with chmod.

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