I can run this script manually and it works. However running it during a deployment fails. I have the Tentical running with a Administrator user account.
I get an error “The term ‘au’ is not recognized as the name of a cmdlet, function, script file, or operable …”
I have tried all I can think of.
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
Write-Host "Deployment script start..."
$pkgSource=(Resolve-Path .\).Path
$target=$OctopusParameters["WebDir"] + "\" + $OctopusParameters["HostName"] + "\IdentityAureliaCustomAuthPages"
Write-Host "Package Source Path: " $pkgSource
Write-Host "Package Target Path: " $target
cd $target
$node=node -v
Write-Host "Node version: $node"
$git=git --version
Write-Host $git
cd login
Write-Host "Current path: $pwd"
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
Write-Host "Running: npm install in $pwd"
npm install
npm install aurelia-cli
$environments=$OctopusParameters["AureliaBuildEnvironments"]
$envArray=$environments -split(',')
$cnt=$envArray.Count
Write-Host "There are $cnt environments to build"
for ($i=0; $i -lt $envArray.Count; $i++) {
$env=$envArray[$i]
Write-Host "Building Aurelia environment $env"
$cmd="& au build --env $env"
Invoke-Expression $cmd
Write-Host "Completed building Aurelia environment $env"
}
Write-Host "Finished with deployment of Aurelia apps"
![octoerror.PNG](upload://dJ5LVcqy0RShptAd6wPsDoCuPAo.PNG)