At some point Microsoft changed the default settings for "Allow users to run custom script" to Prevent.
This means that we can't upload files to the Style Library or obviously run custom scripts.

To change this globally, you can update the settings in the SharePoint Admin area, however this has up to a 24 hour delay.
There's another method that you can use with the SharePoint Management Shell

I'm going to outline both approaches here.

The Admin Portal Method

Browse to your SharePoint Admin site in Office 365.
eg: https://yoursharepointsite-admin.sharepoint.com

Click the Settings option in the left navigation.

This is the global setting however it can take up to 24 hours to activate. Which isn't great if you need to update things straight away. If you do, see the next option.

The PowerShell Method

After installing the SharePoint Management Shell, open a PowerShell session and run the following:

Connect-SPOService -url https://yoursharepointsite-admin.sharepoint.com
Set-SPOsite https://yoursharepointsite.sharepoint.com -DenyAddAndCustomizePages 0

This PowerShell command will take effect immediately, but I've found that this can be reset at some point, so my suggestion is to also update it in the Admin area.