新手问题 [已解决] Rails 创建新项目失败被提示 ‘could not find railties’

n00b1 · 2013年01月08日 · 最后由 n00b1 回复于 2013年01月08日 · 6364 次阅读

看到该提示后我已经成功安装了该 gem 了(下面第一二行可见),但还是有这个报错,我是在 rvm 创建的 sandbox 中操作的,但操作貌似都是正常的呀,在 sandbox 中用的 gem install ...来安装的 gem

/home/omrails [ruby-1.9.3-p194@omrails] $gem install railties
Successfully installed railties-3.2.10
1 gem installed
/home/omrails [ruby-1.9.3-p194@omrails] $sudo rails new omrails
/home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [] (Gem::LoadError)
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194@omrails/bin/rails:18:in `<main>'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194@omrails/bin/ruby_noexec_wrapper:14:in `eval'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194@omrails/bin/ruby_noexec_wrapper:14:in `<main>'
/home/omrails [ruby-1.9.3-p194@omrails] $

#1 楼 @yesmeck 回 yesmeck 达人,不要 sudo 会提示权限错误,难道是该目录权限问题?

drwxr-xr-x  2 root    4096 2013-01-08 03:15 omrails
drwxr-xr-x  6 vagrant 4096 2013-01-08 01:55 vagrant
/home [ruby-1.9.3-p194@omrails] $cd omrails/
/home/omrails [ruby-1.9.3-p194@omrails] $rails new omrails
      create
/home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': Permission denied - /home/omrails/omrails (Errno::EACCES)

跑到~目录下面去直接创建就可以了...学习 rails 还顺带将 linux 给学习了...好啊,再次感谢 yesmeck 达人

需要 登录 后方可回复, 如果你还没有账号请 注册新账号