To address this, I examined the hourly weather observations from both Haines and Juneau airports since 1998, when the ASOS platform was introduced. Remarkably, I was unable to find a single instance of a thunderstorm being reported at Haines; it seems unlikely that this could be correct, but perhaps thunder really is that rare, as the town is surrounded by high mountains on nearly all sides. In Juneau the situation is better (for this study), with 13 distinct thunderstorm episodes reported since 1998. Several of these occurred in the cold season and were undoubtedly related to strong lifting associated with vigorous frontal passages. I'm more interested in the 8 summer events, which are as follows:
June 28, 2000
June 27-28, 2004
July 24, 2004
August 10, 2004
August 18, 2004
June 17, 2013
June 24-25, 2013
July 13, 2013
Interestingly, all but one of these events occurred in 2004 and 2013, which were of course very warm summers in Alaska. Looking at the sea surface temperature maps from these months, every one shows above-normal temperatures in the northeast Pacific close to the Alaska panhandle; so this appears to be an important factor.
Looking more closely at the individual events, I created maps of the 500 mb height (pressure) anomaly and 850 mb temperature anomaly at 12-hour intervals surrounding the onset time of each thunderstorm event. These maps are shown below. Note that two of the episodes included two distinct thunderstorms separated by many hours, so for these I created two sets of maps. We can (perhaps simplistically) summarize the weather situation in Juneau for each event as follows:
June 28, 2000 -- upper-level low arriving from the Pacific, low-level cold front
June 27-28, 2004 -- very warm low-level air retreating northwestward, upper-level ridging to the north
July 24, 2004 -- upper-level trough arriving from the Pacific, low-level cold front
August 10, 2004 -- cold front arriving from the Pacific
August 18, 2004 -- very warm low-level air, ridging aloft, no obvious trigger
June 17, 2013 -- upper-level low diving down from the Yukon (described by Mike in his comment)
June 24-25, 2013 -- very warm low-level air migrating to the northwest, weak ridging to the north
July 13, 2013 -- upper-level low moving slowly southward over British Columbia.
Overall, we have three events with an obvious cold front arriving from the Pacific; two events with an upper-level low moving southward over Canada; and three events with no obvious upper-level trigger but with very warm air residing over or migrating away from the area. So we see that there is considerable variety in the specifics of the weather patterns that bring thunderstorms to Juneau; but a common factor to all of the events is the unusually warm ocean water along the coast. In years with near-normal or below-normal ocean temperatures, it appears that summer thunderstorms are much rarer in Juneau and presumably also in surrounding locations near the coast.