The WIMPs are considered one of the favorable dark matter (DM) candidates, but as the upper bounds on the interactions between DM and standard model (SM) particles obtained by the upgraded facilities of DM direct detections get lower and lower. Researchers turn their attentions to search for less massive DM candidates, i.e. light dark matter of MeV scale. The recently measured anomalous transition in $^8$Be suggests that there exists a vectorial boson which may mediate the interaction between DM and SM particles. Based on this scenario, we combine the relevant cosmological data to constrain the mass range of DM, and have found that there exists a model parameter space where the requirements are satisfied, a range of $10.4 \lesssim m_{\phi} \lesssim $ 16.7 MeV for scalar DM, and $13.6 \lesssim m_{V} \lesssim $ 16.7 MeV for vectorial DM is demanded. Then a possibility of directly detecting such light DM particles via the DM-electron scattering is briefly studied in this framework.