简体   繁体   中英

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

ruby version: 2.7.3

Hi. I am very puzzled...

I have a file path company/service/v1/my_proto_pb.rb . When I tried to require it in rails console it gives the cannot load such file error:

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:

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

But the .rb and .rbi file both exist in the v1 folder. 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?

Thank you!

Nevermind... The issue was that my local code was not synced to the remote rails server correctly. Locally the files are in the v1 folder but somehow remotely they are in the V1 folder, which caused the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM