For modern UI, anyway you can use a modern script editor to do the same thing. However once you switch to another page, the button still will returns. If you want to restrict users from sharing, it may be better to change the sharing settings to make only owners can share.
Then other members will not have this button on the right top.
From the error msg, it indicates a curl receive an error of CURLE_RECV_ERROR which means there was some issue that prevented the data from being received during the cloning process.
Typically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred.
Another possible cause ...
It depends on what tools you will use to connect to SharePoint,
Either of below you can use to connect,
PowerShell : There is a list of command lines ready to use, we have sp powershell and pnp
SharePoint rest api , 1 option if you intend to connect via client side browser
Hope it helps! Happy SharePointing!