Please specify what version of the library you are using: [2.0.13]
Please specify what version(s) of SharePoint you are targeting: [SharePoint Online]
Current user should able to like or unlike item in document library.
We have created a web part which renders an specific image or a specific video from a document library.
In library's ratting setting is enabled and experience is set to Likes.

We are trying to set like and unlike for the current user as per documented in this link, but we are receiving below error.
Error: Error making HttpClient request in queryable [500] Internal Server Error ::> {"odata.error":{"code":"-1, System.NotSupportedException","message":{"lang":"en-US","value":"Likes are not supported in this item."}}}
at new HttpRequestError (parsers.js:130)
at Function.
at step (tslib.es6.js:100)
at Object.next (tslib.es6.js:81)
at fulfilled (tslib.es6.js:71)
Call any of the code given in this link on click of an icon in SPFx web part.
Based on what I can tell the "like" API endpoint only works on pages in the Site Pages library. I'm not sure why, but given the error is internal (500) and I get the message "Likes are not supported in this item." I suspect it's by design.
Digging a little deeper it appears that there's a Reputation endpoint that can be used to like things other than pages... I'll see if we can implement that on item.
As far as I know, legacy reputations API is not exposed to REST. So it can only be bits of CSOM packages.
UPD: I was wrong, it's exposed now at /_api/Microsoft.Office.Server.ReputationModel.Reputation.SetLike(listID=@a1,itemID=@a2,like=@a3)
Well... sort of it is based on some reverse engineering of the "Number of Likes" column in a test document library I created. If you click on the heart, it will call this endpoint:
/_api/Microsoft.Office.Server.ReputationModel.Reputation.SetLike(listID=@a1,itemID=@a2,like=@a3)
🤷♀️
Yep, did the same and checked what's happening. Just recalling the last time I needed likes in a list I ended up with JSOM. But that endpoint was actually like always there...

Thank you team for looking into it.
However, I am able to mange the functionality with help of code given in this link using PnPJS item update method.
Looking forward to hear from you guys.
_Thank you!_
I wonder if using that code actually does what needs to be done in the background... but if you're happy with it that's great. I have implemented the fix and it will roll out in the next release 2.1.0.