[英]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.