我正在使用这个Ruby on Rails gem,名为dockerfile-rails,尝试在我的应用中生成一个dockerfile,但它只是抛出了一个错误,将一个空的Dockerfile添加到我的根目录:
我运行了命令bundle add dockerfile-rails --optimistic --group development
在他们的文档中描述,我可以看到gem "dockerfile-rails", ">= 1.5", :group => :development
在Gemfile中,但是当我尝试运行bin/rails generate dockerfile
时,我在终端中得到了一个错误:
block in api_client_dir': undefined method 'load_file' for JSON:Module (NoMethodError)
字符串
有人知道哪里出了问题吗?我使用ruby -v 2.7.2p137
和Rails -v 7.0.6
。
1条答案
按热度按时间cetgtptt1#
这是dockerfile-rails gem中的一个bug。有几种解决方案:
1.更新你的Ruby版本到>= 3.0 -这个问题不会在这个版本上发生。
1.向dockerfile-rails报告问题,等待修复。
1.对JSON模块应用合理的补丁,如下所示:
字符串
在dockerfile-rails加载之前。
1.从Gemfile中注解或删除
vite-ruby
,生成Dockerfile,然后取消注解vite ruby
。