1
votes

I have an application that is running fine locally but gives an error when running in an Azure AppService:

InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: npm ERR! Error: ENOENT, open 'D:\home\site\wwwroot\ClientApp\node_modules\start\package.json'

I can provide much more information if anyone thinks they can help.

1
You are trying to start angular app in dev mode on Azure ?ibenjelloun
is that the problem, hod do I put in release mode?davy
Run the ng build --prod it will generate compiled static files in a dist directory, then you can expose the static files like any other static files.ibenjelloun

1 Answers

2
votes

The error is about angular routes and service could not recognize them.

Have you created webconfig file ?

I had the same error and be able to fix it like

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Angular Routes" stopProcessing="true">
                    <match url=".*NEWPDS.*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                     <action type="Rewrite" url="./index.html" />
                </rule>

            </rules>
            <outboundRules>

            </outboundRules>
        </rewrite>
    </system.webServer>

</configuration>

When using IIS.