Failed to build frontend on VS Code from azure-search-openai-demo repo

Chhanechhara, Milin 100 Reputation points
2023-05-24T14:03:19.22+00:00
Building frontend


> frontend@0.0.0 build /home/milin/azure-search-openai-demo/app/frontend
> tsc && vite build

/home/milin/azure-search-openai-demo/app/frontend/node_modules/vite/bin/vite.js:2
import { performance } from 'node:perf_hooks'
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.0.0 build: `tsc && vite build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the frontend@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/milin/.npm/_logs/2023-05-24T13_58_51_618Z-debug.log
Failed to build frontend
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,080 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sedat SALMAN 14,180 Reputation points MVP
    2023-05-24T14:35:08.15+00:00

    Given the information above i can say the following

    1. Upgrade Node.js: Upgrade your Node.js to version 14.13.0 or higher. This will allow Node.js to understand the node: prefix in your imports.

    Check Vite version: Ensure you're using a version of Vite that is compatible with your version of Node.js. If you're using an older version of Node.js, you may need to downgrade Vite or upgrade Node.js.

    Modify the import statement: If upgrading Node.js or checking Vite version is not an option, another workaround could be to modify the import statement to remove the node: prefix. However, this is not recommended unless absolutely necessary, as it might lead to compatibility issues with other parts of your code or with Vite.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.