EPERM: операция не разрешена - NPM Angular 7 на IIS с бэкэндом .Net Core 2.1 - PullRequest
0 голосов
/ 21 мая 2019

Привет, ребята, я сделал угловое 7 приложение для visual studio 2017. Итак, у меня есть машина AWS на Windows 10 с IIS.

Когда я загрузил приложение, я получил эту ошибку:

AggregateException: произошла одна или несколько ошибок. (Произошла одна или несколько ошибок. («Запуск» сценария NPM завершился без указания на то, что Angular CLI слушал запросы. Вывод ошибки был: Ошибка: EPERM: операция не разрешена, mkdir 'C: \ Windows \ System32 \ Config \ systemprofile \ AppData \ Roaming \ НПМ'

TypeError: Невозможно прочитать свойство 'get' из неопределенного

Итак, изображение с ошибкой iis возвращает:

enter image description here

Полная текстовая ошибка:

   An unhandled exception occurred while processing the request.

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 errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
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:228:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20)
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
if (npm.config.get('json')) {
^

TypeError: Cannot read property 'get' of undefined
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
at process.emit (events.js:189:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'

TypeError: Cannot read property 'get' of undefined

at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
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:228:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20)
at Conf.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:229:20)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205

if (npm.config.get('json')) {

^


TypeError: Cannot read property 'get' of undefined

at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)

at process.emit (events.js:189:13)

at process._fatalException (internal/bootstrap/node.js:496:27)

))
System.Threading.Tasks.Task<TResult>.GetResultCore(bool waitCompletionNotification)

InvalidOperationException: 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 errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
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:228:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20)
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
if (npm.config.get('json')) {
^

TypeError: Cannot read property 'get' of undefined
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
at process.emit (events.js:189:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'

TypeError: Cannot read property 'get' of undefined

at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
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:228:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20)
at Conf.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:229:20)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205

if (npm.config.get('json')) {

^


TypeError: Cannot read property 'get' of undefined

at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)

at process.emit (events.js:189:13)

at process._fatalException (internal/bootstrap/node.js:496:27)

Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(string sourcePath, string npmScriptName, ILogger logger)

Stack Query Cookies Headers
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 errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18) 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:228:22) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7 at Array.forEach (<anonymous>) at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20) at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53 C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
 if (npm.config.get('json')) {
 ^

 TypeError: Cannot read property 'get' of undefined
 at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
 at process.emit (events.js:189:13)
 at process._fatalException (internal/bootstrap/node.js:496:27)
 Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm' 
 TypeError: Cannot read property 'get' of undefined 
 at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18) 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:228:22) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7 at Array.forEach (<anonymous>) at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20) at Conf.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:229:20) C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205

 if (npm.config.get('json')) {

 ^


 TypeError: Cannot read property 'get' of undefined

 at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)

 at process.emit (events.js:189:13)

 at process._fatalException (internal/bootstrap/node.js:496:27)

 ))
System.Threading.Tasks.Task<TResult>.GetResultCore(bool waitCompletionNotification)
Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout<T>(Task<T> task, TimeSpan timeoutDelay, string message)
Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task<Uri> baseUriTask, CancellationToken applicationStoppingToken, bool proxy404s)
Microsoft.AspNetCore.Builder.SpaProxyingExtensions+<>c__DisplayClass2_0+<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Show raw exception details
InvalidOperationException: 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 errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18) 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:228:22) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7 at Array.forEach (<anonymous>) at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20) at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53 C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
 if (npm.config.get('json')) {
 ^

 TypeError: Cannot read property 'get' of undefined
 at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
 at process.emit (events.js:189:13)
 at process._fatalException (internal/bootstrap/node.js:496:27)
 Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm' 
 TypeError: Cannot read property 'get' of undefined 
 at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18) 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:228:22) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7 at Array.forEach (<anonymous>) at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20) at Conf.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:229:20) C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205

 if (npm.config.get('json')) {

 ^


 TypeError: Cannot read property 'get' of undefined

 at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)

 at process.emit (events.js:189:13)

 at process._fatalException (internal/bootstrap/node.js:496:27)

Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(string sourcePath, string npmScriptName, ILogger logger)

Show raw exception details
System.InvalidOperationException: 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 errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    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:228:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at process.emit (events.js:189:13)
    at process._fatalException (internal/bootstrap/node.js:496:27)
Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'

TypeError: Cannot read property 'get' of undefined

    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    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:228:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82: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:173:20)
    at Conf.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:229:20)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205

  if (npm.config.get('json')) {

                 ^


TypeError: Cannot read property 'get' of undefined

    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)

    at process.emit (events.js:189:13)

    at process._fatalException (internal/bootstrap/node.js:496:27)

 ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)

Здесь Startup.cs

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

        // In production, the Angular files will be served from this directory
        services.AddSpaStaticFiles(configuration =>
        {
            configuration.RootPath = "ClientApp/dist";
        });
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Error");
            app.UseHsts();
        }

        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseSpaStaticFiles();

        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller}/{action=Index}/{id?}");
        });

        app.UseSpa(spa =>
        {
            // To learn more about options for serving an Angular SPA from ASP.NET Core,
            // see https://go.microsoft.com/fwlink/?linkid=864501

            spa.Options.SourcePath = "ClientApp";

            if (env.IsDevelopment())
            {
                spa.UseAngularCliServer(npmScript: "start");
            }
        });
    }
}

Я установил последнюю версию nodejs на сервере. Где я не прав?

Спасибо

1 Ответ

0 голосов
/ 30 мая 2019

Попробуйте настроить вашу среду на Производство.Я думаю, что это как-то связано с попыткой запуска NPM

<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
...