Sometimes you might not have access to direct internet and when that happens, you can be limited.
To get around this, you can authenticate yourself using proxy. Use the following command :-
where proyxserver.com is your proxy.
npm config set proxy http://"dev.username:password"@proxyserver.com:80 npm config set https-proxy http://"dev.username:password"@proxyserver.com:80
I also notice that setting this, results in 418 or probably 404.
npm config set registry "http://registry.npmjs.org/"
So if you have this, try to remove it using npm config edit
In your deployment, you might want to link function app from different resource group with a specific service plan. Working with az cli blindly (especially with dodgy documentation) could be a challenge.
Here is a tested script az cli to tied a function app into a specific service plan (that you might have created somewhere else) that might help.
az functionapp create --name $env:environment$env:functionapp_name --resource-group $env:environment$env:resource_group_name --storage-account $env:environment$env:storage_accountname -p /subscriptions/$env:Subscription/resourceGroups/$($env:environment)$env:serviceplan_resource_group/providers/Microsoft.Web/serverFarms/$($env:environment)$env:serviceplan_name --app-insights-key $appInsightId --runtime dotnet --os-type Windows
$xxx - are variables for powershell and you can tell that the script is written in powershell.