That is a thing I never had trouble with (most things I do/did have trouble with lol). My method was to commit to memory the low E string, using the open string and conventional fretboard markers as landmarks. So for example, the low E just learn
E|-0--3--5--7--9------12
E G A B C#(Db) E
Any note not in that set is always going to be 1 fret away from a note that is. So if you need to get a G#, you’ll already have memorized that fret number 3 is G, so G# is just a fret north of that. Over time you’ll stop leaning on the landmarks and you’ll know all 12 frets
Do the same with the A string
A|-0--3--5--7--9------12
A C D E F#(Gb) A
Those were the only 2 strings I committed to memory. I then just did the D string by knowing octaves - it is always the same as the E string, just 2 frets ahead. So, you need to find a G note on the D string. No problem, you have already memorized it’s the 3rd fret on the E string, so it’s going to be the 5th fret on the D string.
D|----5
A|-----
E|-3---
G G
You’ll have the same octave relationship between the A and G strings as you did between the E and D strings.
For the B string, I just substracted 2 frets from the memorized notes on the A string. Ex you need to find a D note on the B string. You’ve memorized that it’s the 5th fret on the A string, so it’s 2 frets lower on the B string - the 3rd fret
B|---3
G|----
D|----
A|-5--
D D
Then obviously the high E is the only string left, and you’ve already learned that by learning the low E. So that’s not a ton to “memorize”. It’s really just the names of the notes on the fretboard markers of the E and A string, then a few simple rules and all the others you ‘relate’ to the ones you’ve memorized. Over time, you’ll just know the whole thing. That worked like a charm for me, and I passed that along to all the students I taught and they seemed to mostly ‘get it’.