React Web App will not build from Azure Cognitive Search Tutorial

Ziggy Zulueta 495 Reputation points MVP
2023-06-16T11:23:37.1166667+00:00

I am creating an Azure Static Web App to show my Azure Cognitive Search application as shown in this tutorial:

https://learn.microsoft.com/en-us/azure/search/tutorial-csharp-deploy-static-web-app

The issue here is that the Static Web App would not build. I get the following error in github under Build and Deploy Job:

npm ERR! code ERESOLVE

161npm ERR! ERESOLVE unable to resolve dependency tree

162npm ERR!

163npm ERR! While resolving: my-reacte-app@0.1.0

164npm ERR! Found: react@18.2.0

165npm ERR! node_modules/react

166npm ERR! react@"^18.2.0" from the root project

167npm ERR!

168npm ERR! Could not resolve dependency:

169npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4

170npm ERR! node_modules/@material-ui/core

171npm ERR! @material-ui/core@"^4.12.4" from the root project

172npm ERR!

173npm ERR! Fix the upstream dependency conflict, or retry

174npm ERR! this command with --force, or --legacy-peer-deps

175npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

176npm ERR!

177npm ERR! See /github/home/.npm/eresolve-report.txt for a full report.

178

179npm ERR! A complete log of this run can be found in:

180npm ERR! /github/home/.npm/_logs/2023-06-16T09_53_21_090Z-debug-0.log

I checked online as well and it seems that material-ui/core@4.12.4 is already deprecated.

Any idea on how to fix this?

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,350 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,178 questions
{count} votes

Accepted answer
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-06-21T13:08:28.1266667+00:00

    Apologies for any confusions and lack of clarity in the doc. I'll also relay this feedback internally to our content team.

    Depending on the sample repo, typically, you would try these steps:

    To update the @material-ui/core package version in your GitHub repository, you can follow these steps:

    1. Open your GitHub repository in a web browser.
    2. Navigate to the package.json file in your repository.
    3. Click the pencil icon in the top right corner of the package.json file to edit the file.
    4. Update the @material-ui/core version to the latest version that is compatible with react version
    5. Scroll down to the bottom of the page and click the "Commit changes" button to save your changes.

    You may checkout the suggestions outlined in this similar discussion thread: Error while trying to install mui core with npm.

    Just to highlight, adding Search to Static WebApps is 4-part tutorial.

    1 - Overview of adding search to a website with .NET

    2 - Create and load Search Index with .NET

    3 - Deploy the search-enabled .NET website

    4 - .NET Search integration cheat sheet


0 additional answers

Sort by: Most helpful

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.