error AggregateException The NPM script 'start' exited without indicating that the Angular CLI when publish asp.net core and angular 9?

ahmed salah 3,216 Reputation points
2021-08-09T07:55:52.463+00:00

I work on asp.net core 2.2 with angular 9

when publish web app on IIS I get error

but can't solve it so can you help me please

error as below :

AggregateException: One or more errors occurred. (One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'

 TypeError: Cannot read property 'get' of undefined

 at errorMessage (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-message.js:38:39)
 at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:201:13)
 at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:78:20
 at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
 at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
 at Array.forEach (<anonymous>)
 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
 at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
 at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:171:20)
 C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:97
 var doExit = npm.config.loaded ? npm.config.get('_exit') : true
 ^

 TypeError: Cannot read property 'loaded' of undefined
 at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:97:27)
 at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
 at process.emit (events.js:223:5)
 at process._fatalException (internal/process/execution.js:150:25)
 Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'

What I have tried:

1- install .net core 2.2.7 hosting bundle

2-install vc++2015 distribution

but I don't know what is remaining to do

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,244 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 58,041 Reputation points
    2021-08-09T14:36:55.75+00:00

    It looks like you configured dev mode on the server so spa services it is trying to use the node dev server. But the publish does not include the angular sources.

    0 comments No comments

  2. Ángeles Valdivieso Pardo 1 Reputation point
    2021-08-09T16:10:45.007+00:00

    Al parecer el problema es el servidor de spa, trata de revisar la configuración y tus fuentes.

    0 comments No comments

  3. HuryShen - MSFT 321 Reputation points
    2021-08-10T05:34:21.14+00:00

    Hi @ahmed salah ,

    I think the problem can be caused by incorrect environment you specified. Please try to set the environment to production with the line of code <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />.


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  4. Li ZhengXian 1 Reputation point
    2021-12-20T13:24:40.593+00:00

    this error happens due to json files wrong encoding so you must ensure that all your json files like (angular-cli.json, tslint.json and tsconfig.json) are UTF-8 encoded not UTF With BOM.

    0 comments No comments