azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

ERROR: error executing step command 'package --all': failed building service 'backend': failed invoking event handlers for 'prebuild', 'prebuild' hook failed with exit code: '0'

Open fonsecabarros opened this issue 7 months ago • 6 comments
trafficstars

When I try to use the command azd up, it returns this error:

Packaging services (azd package)

(x) Failed: Packaging service backend

ERROR: error executing step command 'package --all': failed building service 'backend': failed invoking event handlers for 'prebuild', 'prebuild' hook failed with exit code: '0', Path: 'C:\Users\tbarros\AppData\Local\Temp\azd-prebuild-1333188587.ps1'. : executable file not found in %PATH%

Every time I try to provision and deploy, it generates a different .ps1 (temp) file. I tried to incorporate that into the Path with no success.

fonsecabarros avatar Apr 02 '25 14:04 fonsecabarros

I've asked the azd team to take a look at this report, as I'm not sure what's going on.

pamelafox avatar Apr 03 '25 18:04 pamelafox

executable file not found in %PATH%

This means powershell 7 is not installed. AZD needs powershell7 to run ps1 hooks.

What azd version are you using? @fonsecabarros . The error from AZD should be describing the error and how to fix it in a better way since version 1.13.2

vhvb1989 avatar Apr 03 '25 18:04 vhvb1989

The powershell was indeed not updated but even after updating it to the version 7.5, whenever I start provisioning the app, it gets stuck like the below without any progress.

Image

fonsecabarros avatar Apr 03 '25 19:04 fonsecabarros

The hook is running cd ../frontend;npm install;npm run build

You can manually try this in your side to see if something is blocking this. npm install typically takes a long time in Windows.

vhvb1989 avatar Apr 03 '25 22:04 vhvb1989

After updating the powershell and running the npm install, it proceeded and got to the point where I was before. I'm working in a medium size company where I have Contributor access to most resources. However, for example, I can't create a resource group, I have access to one where I can manage these resources.

With that said, what happens is that when I try to run azd up, I have the following error message:

Image

I have changed the values in the main.parameters.json with all the resource groups and services I have already available and set and still doesn't allow me to proceed. Is there any way to deploy this rag chat without being an administrator? Should I get this answer anywhere else? I appreciate your help on this.

fonsecabarros avatar Apr 08 '25 15:04 fonsecabarros

Apologies for the late response - it seems you might not have all the necessary permissions. One thing maybe worth trying is changing the Bicep to use resource group scoped deployments.

Regarding the original error, there are some cases where a suggestion message to install PowerShell 7 should be shown but isn't. https://github.com/Azure/azure-dev/issues/5453 is tracking that.

JeffreyCA avatar Jul 08 '25 21:07 JeffreyCA