You will have to enable the custom scripts on your SharePoint Online Site/tenant.
For a particular site collection, use:
Connect-SPOService -Url https://tenant-admin.sharepoint.com
Set-SPOSite -Identity https://tenant.sharepoint.com/sites/contoso -DenyAddAndCustomizePages 0
To enable it for complete tenant, go to SharePoint Online Admin center in classic settings page.
In Custom scripts section, click "Allow users to run custom script on personal sites" and "Allow users to run custom script on self-service created sites"
Please be aware the Microsoft is working towards disabling the scripts completely from SharePoint Online. The best way to customize would be using Spfx solutions.