gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 17:26:18 25 4
gpt4 key购买 nike

当我运行命令生成模型

rails generate model Ip ip_address:string

我在控制台收到以下错误

`class_eval': No such file or directory - 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>'

请问我应该怎么做才能生成模型?

最佳答案

是的,我找到了原因:

原因是我在 rails server --debugger 选项卡中打开了 webrick 服务器

意味着如果 webrick 服务器已经在运行,我们不能运行任何命令,例如 scaffold generate model 将无法工作。

谢谢!

关于ruby-on-rails - 错误: `class_eval':没有这样的文件或目录 - getcwd (Errno::ENOENT),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9097196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com