Knock under hood of 2000 CRV

I have an intermittent knock under the hood, only when idling at a light etc. One mechanic replaced the AC compressor, expansion valve, etc - still a knock. They put in a second new compressor - still knocking. A second mechanic replaced the expansion valve - still knocking. Air conditioner has worked fine from the start.

First, have you had the valves adjusted? These engines can be damaged if the valves are not adjusted regularly. The owners manual iincorrectly recommends adjustment at 100k miles, but many unlucky CRV owners found that their heads were damaged by valves getting out of adjustment well before the 100k mark. To be safe, the valves should be checked every 30k miles.

Second, why do they suspect the AC? Does it knock when the AC is off? Have you tried a higher octane gas?