It's hard to say without more information. Like does the unit have a tower for the taps? If so, Is the tower cooled? If you tap two beers in a row do they both come out mostly foam, or only the first? What temp is the beer coming out of the tap at?
There are many things that can cause excessive foaming. Too short of a beer line is definitely one of them. There are formulas to help size the length correctly but somewhere in the 7-10 ft range is common.
Also if the beer is not cold, or most of the line is not cold you will get a lot of foam. Thry to keep the keg and the line refrigerated.