0

So I was trying to deploy my react app to an Azure Web App. I used a Github Action to build and install the App and then ZIP Deploy it to Azure. The Problem is that once I open up the WebApp Page it shows me an Application Error (react-scripts could not be found).
I found out that once I copy the react-scripts.cmd / ps1 (from local /node_modules/.bin) to the node_modules/.bin folder of the webapp "https://{WEBAPP-NAME}.scm.azurewebsites.net" it works. Unfortunately I would have to do that after every build. How can I come up with a solution to this error?

What I already tried:

  • Update node and npm
  • Remove package-lock Thanks in advance

Max

My package.json:

Package.json

2 Answers2

0

It looks like this issue: npm package.json scripts not being called

Try running npm run-script if you want to execute a script that is not executed by a built-in npm command.

Harshita Singh
  • 4,590
  • 1
  • 10
  • 13
0

So I found out, that react-scripts is only working in dev environments. But Azure uses a production env. Therefore the github action not only has to install the prod node_modules (npm install) but also the dev modules (npm install --only=dev).

Reference: https://github.com/mars/create-react-app-buildpack/issues/32#issuecomment-276081892