当我运行命令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>'
请告诉我怎样才能生成模型?
答案 0 :(得分:6)
是的,我找到了原因:
原因是我在标签rails server --debugger
表示如果webrick服务器已经运行,我们就无法运行scaffold
generate model
之类的命令。
谢谢!