Azure-Samples / azure-search-openai-demo

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
https://azure.microsoft.com/products/search
MIT License
5.9k stars 4.04k forks source link

ERROR: failed packaging service 'backend': failed invoking event handlers for 'prepackage', 'prepackage' hook failed with exit code: '1', Path: '/tmp/azd-prepackage-304620603.sh'. : exit code: 1 #226

Open tekntrash opened 1 year ago

tekntrash commented 1 year ago

When typing azd up, and after choosing the right subscription and US-west I get

10 packages are looking for funding run npm fund for details

found 0 vulnerabilities | ===| Packaging service backend

frontend@0.0.0 build tsc && vite build

| ===| Packaging service backendfile:///root/azure-search-openai-demo/app/frontend/node_modules/vite/bin/vite.js:7 await import('source-map-support').then((r) => r.default.install()) ^^^^^

SyntaxError: Unexpected reserved word at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18) at async link (internal/modules/esm/module_job.js:42:21) (x) Failed: Packaging service backend

ERROR: failed packaging service 'backend': failed invoking event handlers for 'prepackage', 'prepackage' hook failed with exit code: '1', Path: '/tmp/azd-prepackage-304620603.sh'. : exit code: 1

s4096087 commented 1 year ago

Im getting the same issue when choosing locatio with 'azd up' command. I can set the other env variables up to the 'choose location' command without issue. Is it possible for someone to create an env file template that everyone can substitute to work for their requirments?

JTYEG commented 1 year ago

You also need to choose target location, the regions that currently support the models used in this sample are East US or South Central US.

yoelnono commented 1 year ago

Can you run pwsh.exe in Powershell? I couldn't and this fixed it.

fakoe commented 1 year ago

I have the exact same problem, but I tried to select East US aswell as South Central US.

My setup is: Ubuntu 22.04 (latest) server-only nodejs installed npm installed python 3.10 installed python3-pip installed

Using azd auth login --use-device-code for login. azd init -t azure-search-openai-demo ran successfully azd up runs into the error, described above:

up to date, audited 122 packages in 736ms

10 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
  |====== | Packaging service backend
> frontend@0.0.0 build
> tsc && vite build

  |=====  | Packaging service backendfile:///home/chatgpt/app/frontend/node_modules/vite/bin/vite.js:7
    await import('source-map-support').then((r) => r.default.install())
    ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)
  (x) Failed: Packaging service backend

ERROR: failed packaging service 'backend': failed invoking event handlers for 'prepackage', 'prepackage' hook failed with exit code: '1', Path: '/tmp/azd-prepackage-2524731270.sh'. : exit code: 1
fakoe commented 1 year ago

I found the solution for my problem:

My nodejs was not up-to-date, I was running it on 12.X. After upgrading to 18.X i now can proceed in the installation. The requirement is at least 14.18.0, if I'm correct.

DireWolfCoder commented 1 year ago

had the same issue,

My operating system is windows.

Had to upgrade my powershell: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.3#installing-the-msi-package

ApurvaL commented 1 year ago

I have installed node.js 18.16 and powershell 7.3 also selected the location as East US as suggested above but still getting the below error.

error: Cannot find module '.\typescript\bin\tsc' at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v18.16.0 (x) Failed: Packaging service backend

ERROR: failed packaging service 'backend': failed invoking event handlers for 'prepackage', 'prepackage' hook failed with exit code: '1', Path: '.\Temp\azd-prepackage-3804030346.ps1'. : exit code: 1

Already tried uninstalling and reinstalling node.js multiple times. Any solution would be really helpful.

DhavalWI commented 1 year ago

I have installed node.js 18.16 and powershell 7.3 also selected the location as East US as suggested above but still getting the below error.

error: Cannot find module '.\typescript\bin\tsc' at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v18.16.0 (x) Failed: Packaging service backend

ERROR: failed packaging service 'backend': failed invoking event handlers for 'prepackage', 'prepackage' hook failed with exit code: '1', Path: '.\Temp\azd-prepackage-3804030346.ps1'. : exit code: 1

Already tried uninstalling and reinstalling node.js multiple times. Any solution would be really helpful.

yeah i have also followed every steps but the same error im facing. have you found any ways to run this?

pamelafox commented 1 year ago

If you're unable to use the local environment for some reason, another possibility is to use GitHub Codespaces. This repo works pretty well in Codespaces, everything will be installed for you.

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.

brentkendall commented 3 months ago

I got this to work by running my command in PowerShell instead of a CMD prompt. Also, it wasn't just normal PowerShell; I had to install an older version of it: PowerShell 7 from https://github.com/powershell/powershell. After installing, I ensured I could run pwsh.exe from a PowerShell terminal.