Built-in touchpad functional but not detected by System Preferences after installing macOS High Sierra I completely erased the HDD and reinstalled macOS (High Sierra), but the touchpad is not detected in System Preferences, which shows me the error "No touchpad detected." 

The touchpad is working though, I just can't use System Preferences to make any modifications to the settings. 



I yet again reinstalled it from a flash disk and have the same problem.
As per the asker's comment:


  This happens while laptop didn't have a battery installed , after installing the battery everything worked as normal .


I had the same "trackpad not found" error on a MacBook Pro 13 inch mid-2010 running macOS 10.13 "High Sierra" and now 10.14 "Mojave" beta 2. I removed the 8-year-old battery because it swelled to the point the trackpad couldn't physically click. I reconnected the battery and the Trackpad preferences work again.

I'm inclined to see if the hackintosh community has found any methods which  force the Trackpad preference pane to appear (e.g. fooling macOS into thinking there's a battery installed). If allowed by Ask Different, I'll update my answer with such workarounds.

Digression:

I consider this behavior a bug, because it wrongly assumes "all MacBooks have batteries installed". The presence of a battery doesn't indicate presence of a trackpad; the presence of a trackpad indicates presence of a trackpad.

But, Apple could argue that the user was warned by the sticker on the battery itself to not remove it; so what happens after removing or replacing it is somehow the user's responsibility.

The last MacBooks with removable batteries (2008 Unibody MacBook and MacBook Pro) were last supported by OS X 10.11 "El Capitan"; I do not know if it contains this bug; even if it did, it would not get fixed (10.11 now receives security updates only).

The only "legitimate" scenario I've thought of that would cause this issue is if the battery electronics, the logic board's battery circuitry, or the connections between the two are faulty, causing macOS to think there's no battery installed. As this scenario is unlikely (hopefully), I think the behavior of macOS is unlikely to be fixed.