I have had two kinds of creaking noise in my trail 5 2021.
The first was almost present from the get go when I bought the bike a few years ago. Damn I think this is my third summer with it
Anyways. I found that the noise came from the battery cover. I think it was between the cover and the frame interface. I applied some grease to that seam, both inside and partly outside. Applied a lot of it just to make sure. The noise was gone. And I have honestly never reapplied grease to that area so I guess it’s sort of settled, possible by micro-grinding of that surface/interface by the movement of the riding.
The second time it happened was last summer. So during the second summer of my bike. I located the noise to the headset. I did something I really did not want to do. I started to take the headset apart, by the advice of the local trek dealer. I found it quite dirty and also a little too dry, along with places that had some rusty Color. I again went to work with my grease. Greased it up and put it back together. The end result is zero noise from the headset.
By advice from the local trek dealer, I try to put some waterproof grease on the connections of the headset regularly.