The OP asks about the apparent problem between two requirements for the feast of tabernacles (or shelters or booths, Sukkot):
- Ex 23:14-17 - spells out the three feasts of "pilgrimage" where most men were required to travel to the temple in Jerusalem to celebrate the three great feasts of Passover, Pentecost and Tabernacles. This was the stated reason in John 7 that Jesus' brothers, and later Jesus Himself, went to Jerusalem.
- Lev 23:33-43 - the Torah regulations required everyone, during the feast of tabernacles, to live in "booths" (shelters made of cut tree branches only) for seven days to remind them that they were once pilgrims and lived for 40 years in such booths. Such booths were usually erected in people's yards or on the roofs of their homes.
Ellicott summarizes this situation in his comments on John 7:2 -
(2) The Jews’ feast of tabernacles.—This began on “the fifteenth day
of the seventh month” (Leviticus 23:34), i.e., the 15th of Tishri,
which answers to our September. The interval, then, from Passover to
Tabernacles is one of about five months. The feast continued for seven
days, during which all true Israelites dwelt in booths, in remembrance
of their dwelling in tabernacles when they came out of the land of
Egypt. Like the Feast of Unleavened Bread (Passover) and the Feast of
Harvest (Pentecost), this Feast of In-gathering was one of the “three
times in the year” when every male Jew was required to appear before
the Lord God (Exodus 23:14). Josephus speaks of it as the holiest and
greatest of the feasts. It was at once a thankful memorial of the
national deliverance, and a yearly rejoicing at the close of each
succeeding harvest (Deuteronomy 16:13-16).
If Jesus went to Jerusalem to celebrate the feast of tabernacles, then how could he have lived in one of these tree-branch booths?
Obviously, for those living in Jerusalem, this was no great problem to erect a shelter on the roof or back-yard (if one existed) and celebrate the feast. For out-of-towners this was still not much of a problem because friends and relatives would accommodate extras and some lived just outside the city wall during the feast or in the close-by surrounding towns or farms.
Barnes also observes:
The Jews' feast of tabernacles - Or the feast of tents. This feast was
celebrated on the 15th day of the month Tisri, answering to the last
half of our month September and the first half of October, Numbers
29:12; Deuteronomy 16:13-15. It was so called from the tents or
tabernacles which on that occasion were erected in and about
Jerusalem, and was designed to commemorate their dwelling in tents in
the wilderness, Nehemiah 8:16-18. During the continuance of this feast
they dwelt in booths or tents, as their fathers did in the wilderness,
Leviticus 23:42-43. The feast was continued eight days, and the eighth
or last day was the most distinguished, and was called the great day
of the feast, John 7:37; Numbers 29:35. The Jews on this occasion not
only dwelt in booths, but they carried about the branches of palms;
willows, and other trees which bore a thick foliage, and also branches
of the olive-tree, myrtle, etc., Nehemiah 8:15.
Thus people met in the city of Jerusalem during the day and then retired to their booths to eat and rest for the night. According to the record in John 7, Jesus only went to the festival for half of the feast and not the full time.