在rails上的ruby中创建项目

时间:2014-04-10 18:22:57

标签: ruby-on-rails

您好我已经使用rvm安装了ruby和rails但是每当创建一个新项目时它都会显示一些错误:

创建

/home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/fileutils.rb:250:in `mkdir': Permission denied @ dir_s_mkdir - /blog (Errno::EACCES)
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/fileutils.rb:250:in `fu_mkdir'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/fileutils.rb:224:in `block (2 levels) in mkdir_p'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/fileutils.rb:222:in `reverse_each'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/fileutils.rb:222:in `block in mkdir_p'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/fileutils.rb:208:in `each'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/fileutils.rb:208:in `mkdir_p'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:50:in `block in invoke!'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:49:in `invoke!'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:14:in `empty_directory'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/generators/app_base.rb:139:in `create_root'
from (eval):1:in `create_root'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/commands/application.rb:17:in `<top (required)>'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/cli.rb:14:in `<top (required)>'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/varun/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/varun/.rvm/gems/ruby-2.1.1/gems/railties-4.1.0/bin/rails:9:in `<top (required)>'
from /home/varun/.rvm/gems/ruby-2.1.1/bin/rails:23:in `load'
from /home/varun/.rvm/gems/ruby-2.1.1/bin/rails:23:in `<main>'
from /home/varun/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
from /home/varun/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'

请告诉我我在哪里做错了...谢谢

2 个答案:

答案 0 :(得分:0)

我建议使用http://rbenv.org/代替rvm,使用

轻量级和简化

在尝试启动新的rails项目之前,请确保正确安装Rails和ruby以及在轨道上基本需要ruby。

我不知道你在哪个平台上工作,但是有一个合适的rails环境设置是好的。

http://www.createdbypete.com/articles/ruby-on-rails-development-setup-for-mac-osx/ 在rails设置上查看本教程中适当的ruby。

之后,一个简单的&#34; rails new mynewproject&#34;应该这样做。

答案 1 :(得分:0)

我有同样的错误。我检查了它的用户控件

ls -ld /NepalRailsProject
drwxr-xr-x  2 root  wheel  68 Oct 27 11:02 /NepalRailsProject

其他用户无权访问写入文件。因此,将其更改为可访问文件系统

chmod o+w /NepalRailsProject

并检查

ls -ld /NepalRailsProject
drwxr-xrwx  2 root  wheel  68 Oct 27 11:04 /NepalRailsProject

现在,尝试创建新项目,它将创建新项目。