简体   繁体   English

rails console 无法加载这样的文件,但是一个字母大写它可以工作吗?

[英]rails console cannot load such file but with one letter capitalized it works?

ruby version: 2.7.3 ruby 版本:2.7.3

Hi.你好。 I am very puzzled...我很纳闷...

I have a file path company/service/v1/my_proto_pb.rb .我有一个文件路径company/service/v1/my_proto_pb.rb When I tried to require it in rails console it gives the cannot load such file error:当我试图在 Rails 控制台中要求它时,它给出了cannot load such file的错误:

2.7.3 :005 > require "company/service/v1/my_proto_pb"
Traceback (most recent call last):
/usr/local/rvm/gems/ruby-2.7.3/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require': cannot load such file -- company/service/v1/my_proto_pb (LoadError)

HOWEVER when I capitalize the letter v to V it works:但是,当我将字母v大写为V时,它起作用了:

2.7.3 :006 > require "company/service/V1/my_proto_pb"
 => true

But the .rb and .rbi file both exist in the v1 folder.但是.rb.rbi文件都存在于v1文件夹中。 Why???为什么??? I cannot change the letter in code as it's auto-generated.我无法更改代码中的字母,因为它是自动生成的。 Where exactly does the require look for and how can i check if what's being required exists or not?需求究竟在哪里寻找,我如何检查所require的东西是否存在?

Thank you!谢谢!

Nevermind... The issue was that my local code was not synced to the remote rails server correctly.没关系...问题是我的本地代码没有正确同步到远程 Rails 服务器。 Locally the files are in the v1 folder but somehow remotely they are in the V1 folder, which caused the issue.这些文件在本地位于v1文件夹中,但不知何故它们位于远程V1文件夹中,这导致了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在Rails控制台中加载此类文件 - cannot load such file in Rails console Rails服务器正常工作,Rails控制台无效。 `require&#39;:无法加载此类文件-捆绑程序/安装程序(LoadError)- - Rails server works, Rails console does not. `require': cannot load such file — bundler/setup (LoadError) - rails console需要无法加载此类文件的readline - rails console require cannot load such file readline rails console(`require&#39;:无法加载此类文件) - rails console (`require': cannot load such file) 无法在Rails控制台中加载Ruby EventMachine-没有此类文件可加载 - Cannot load Ruby EventMachine in Rails console - no such file to load Rails 控制台:在“require”中:无法加载此类文件 — readline (LoadError) - Rails console: in `require': cannot load such file — readline (LoadError) 铁路新 <app> 或rails -h craps out with无法加载此类文件 - io / console - rails new <app> or rails -h craps out with cannot load such file — io/console Rails 服务器和 Rails 控制台崩溃:要求&#39;:无法加载此类文件 -- 机架/保护 (LoadError) - Rails server and Rails console crash with: require': cannot load such file -- rack/protection (LoadError) 无法在控制台导轨中加载我的模型 - Cannot load my model in console rails Rails:无法加载此类文件-Ordrin - Rails: Cannot load such file — ordrin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM