错误:`class_eval':没有这样的文件或目录 - getcwd(Errno :: ENOENT)

时间:2012-02-01 14:10:57

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

当我运行命令to generate a model

  

rails生成模型Ip ip_address:string

我收到了控制台

中的跟随错误
  

`class_eval':没有这样的文件或目录 - getcwd(Errno :: ENOENT)

错误描述:

  /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:407:in `class_eval': No such file or directory - getcwd (Errno::ENOENT)
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:91:in `register_klass_file'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:531:in `method_added'
from (eval):1:in `block in public_task'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:407:in `class_eval'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:407:in `block in public_task'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:406:in `each'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:406:in `public_task'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/generators/rails/app/app_generator.rb:162:in `<class:AppGenerator>'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/generators/rails/app/app_generator.rb:145:in `<module:Generators>'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/generators/rails/app/app_generator.rb:138:in `<module:Rails>'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/generators/rails/app/app_generator.rb:3:in `<top (required)>'
from /home/cis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/cis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/application.rb:17:in `<top (required)>'
from /home/cis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/cis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/cli.rb:15:in `<top (required)>'
from /home/cis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/cis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/gems/rails-3.1.1/bin/rails:7:in `<top (required)>'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/bin/rails:19:in `load'
from /home/cis/.rvm/gems/ruby-1.9.2-p290/bin/rails:19:in `<main>'

请告诉我怎样才能生成模型?

1 个答案:

答案 0 :(得分:6)

是的,我找到了原因:

原因是我在标签rails server --debugger

中打开了webrick服务器

表示如果webrick服务器已经运行,我们就无法运行scaffold generate model之类的命令。

谢谢!