Skip to content

Commit

Permalink
update npm install in catch block
Browse files Browse the repository at this point in the history
  • Loading branch information
svetlanabrennan committed Aug 22, 2024
1 parent 8af6880 commit 4e7b7db
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cloud-tooling/azure-site-extension/Content/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ $userModulesPath = "$appRootPath\node_modules"
$UserNodeModulesPath = "$env:HOME"
$packageName = "newrelic"

WriteToInstallLog "Explicitly adding node to path"
$env:PATH = "C:\Program Files\Nodejs;" + $env:PATH

function WriteToInstallLog($output)
{
$logPath = (Split-Path -Parent $PSCommandPath) + "\install.log"
Expand Down Expand Up @@ -90,10 +93,15 @@ function Copy-NodeModules {
WriteToInstallLog "Error at line $errorLine : $errorMessage"

# Install node agent using npm
WriteToInstallLog "Explicitly adding node to path"
$env:PATH = "C:\Program Files\Nodejs;" + $env:PATH
WriteToInstallLog "Executing npm install newrelic@latest"
npm install newrelic@latest
npm install --prefix "$env:HOME\site\wwwroot" newrelic

# Check if the installation was successful
if ($LASTEXITCODE -ne 0) {
WriteToInstallLog "npm install failed with exit code $LASTEXITCODE"
} else {
WriteToInstallLog "npm install completed successfully"
}

WriteToInstallLog "End executing install.ps1."
WriteToInstallLog "-----------------------------"
Expand Down

0 comments on commit 4e7b7db

Please sign in to comment.