title: Microsoft.AspNetCore.SpaServices: Error: ERROR in The given rootPath undefined is not a file of the program
body: <p>I updated .net core 2.2 to .net core 3.1 (first) and then angular version from 6 to 9.
  After updating the .net core the app still working. Didn't see any issues. After I update the angular version I get an error:</p>
  
  <pre><code>Microsoft.AspNetCore.SpaServices: Error: ERROR in The given rootPath undefined is not a file of the program.
  </code></pre>
  
  <p>Anyone with this problem and get it solved?</p>
  
  <p>Thanks!!</p>
  
  <p>Program.cs:</p>
  
  <pre><code>    public class Program
      {
          public static void Main(string[] args)
          {
              CreateWebHostBuilder(args).UseContentRoot(Directory.GetCurrentDirectory())
                                        .UseIISIntegration()
                                        .Build()
                                        .Run();
          }
  
          public static IWebHostBuilder CreateWebHostBuilder(string[] args) =&gt;
  
              WebHost.CreateDefaultBuilder(args)
              .ConfigureLogging(builder =&gt;
  
                  builder.AddFile(options =&gt;
                  {
                      options.FileName                = "Perfix-";            
                      options.LogDirectory            = "LogFiles";   
                      options.FileSizeLimit           = 20 * 1024 * 1024;     
                      options.Extension               = "log";
                      options.RetainedFileCountLimit  = null;                
  
                  }
                  )
                )
              .UseStartup&lt;Startup&gt;();
  
      }
  </code></pre>
  
  <p>Startup.cs:</p>
  
  <pre><code>public class Startup
  {
      public Startup(IConfiguration configuration)
      {
          Configuration = configuration;
      }
  
      public IConfiguration Configuration { get; }
  
  
      public IServiceProvider ConfigureServices(IServiceCollection services)
      {
          services.AddRazorPages();
          services.AddControllers();
          services.AddControllersWithViews();
          // configure strongly typed settings objects
          var appSettingsSection = Configuration.GetSection("AppSettings");
          services.Configure&lt;&gt;(appSettingsSection);
  
  
          var appSettings = appSettingsSection.Get&lt;&gt;();
          var key = Encoding.ASCII.GetBytes(appSettings.jwtSecretKey);
  
  
  
          services.AddAuthentication(x =&gt;
          {
              x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
              x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
          })
          .AddJwtBearer(x =&gt;
          {
              x.RequireHttpsMetadata = false;
              x.SaveToken = true;
              x.TokenValidationParameters = new TokenValidationParameters
              {
                  ValidateIssuerSigningKey = true,
                  IssuerSigningKey = new SymmetricSecurityKey(key),
                  ValidateIssuer = false,
                  ValidateAudience = false
              };
          });
          services.Configure&lt;AppSettings&gt;(Configuration.GetSection("AppSettings"));
  
  
          services.AddDistributedMemoryCache();
          services.AddSession(options =&gt;
          {
              options.IdleTimeout = TimeSpan.FromMinutes(60);   
              options.Cookie.HttpOnly = true;
          });
  
          services.AddDbContext&lt;DarwinContext&gt;(options =&gt;
              options.UseSqlServer(Configuration.GetConnectionString("dbConnection"),
              sqlServerOptions =&gt; sqlServerOptions.CommandTimeout(Configuration.GetSection("AppSettings").GetValue&lt;int&gt;("SQL_TimeOut"))),
              ServiceLifetime.Transient);
  
           services.AddSpaStaticFiles(configuration =&gt;
          {
              configuration.RootPath = "wwwroot";
          });
  
  
          services.AddControllers().AddNewtonsoftJson();
  
          services.AddControllers().AddNewtonsoftJson(options =&gt;
         {
             options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
             options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
         });
  
          // create a Autofac container builder
          var builder = new ContainerBuilder();
  
         builder.Populate(services);
  
          builder.RegisterModule&lt;ServiceModule&gt;();
  
          ApplicationContainer = builder.Build();
          return new AutofacServiceProvider(ApplicationContainer);
      }
  
      public IContainer ApplicationContainer { get; private set; }
  
  
       public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
             if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
          else
          {
              app.UseExceptionHandler("/Error");
              app.UseHsts();
          }
  
          app.UseStaticFiles();
          app.UseRouting();
  
          app.UseSession();
          app.UseAuthentication();
          app.UseAuthorization();
  
          app.UseEndpoints(endpoints =&gt;
          {
  
              endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
          });
  
          app.UseSpaStaticFiles();
          app.UseSpa(spa =&gt;
          {
              spa.Options.SourcePath = "ClientApp";
  
              if (env.IsDevelopment())
              {
                  spa.UseAngularCliServer(npmScript: "start");
              }
          });
  
      }
  }
  </code></pre>
  
  <p>My package.json:</p>
  
  <pre><code>{
    "name": "Darwin",
    "version": "0.0.0",
    "license": "MIT",
    "scripts": {
      "ng": "ng",
      "start": "ng serve",
      "build": "ng build --prod",
      "build:ssr": "npm run build --app=ssr --output-hashing=media",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
      "@angular/animations": "9.0.0",
      "@angular/common": "^9.0.0",
      "@angular/compiler": "9.0.0",
      "@angular/core": "9.0.0",
      "@angular/forms": "9.0.0",
      "@angular/platform-browser": "9.0.0",
      "@angular/platform-browser-dynamic": "9.0.0",
      "@angular/platform-server": "9.0.0",
      "@angular/router": "^9.0.0",
      "@ng-select/ng-select": "^3.7.2",
      "@nguniversal/aspnetcore-engine": "^9.0.0",
      "@nguniversal/module-map-ngfactory-loader": "^8.2.6",
      "angular-sortablejs": "^2.7.0",
      "aspnet-prerendering": "^3.0.1",
      "bootstrap": "^4.4.1",
      "core-js": "^3.6.4",
      "jquery": "^3.4.1",
      "ngx-bootstrap": "^5.3.2",
      "ngx-toastr": "^12.0.0",
      "popper.js": "^1.16.1",
      "rxjs": "^6.5.4",
      "sortablejs": "^1.10.2",
      "tslib": "^1.10.0",
      "xlsx-populate": "^1.20.1",
      "zone.js": "~0.10.2"
    },
    "devDependencies": {
      "@angular-devkit/build-angular": "~0.900.0",
      "@angular/cli": "9.0.1",
      "@angular/compiler-cli": "9.0.0",
      "@angular/language-service": "9.0.0",
      "@types/jasmine": "^3.5.3",
      "@types/jasminewd2": "^2.0.8",
      "@types/node": "^13.7.0",
      "codelyzer": "^5.1.2",
      "jasmine-core": "~3.5.0",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "^4.4.1",
      "karma-chrome-launcher": "~3.1.0",
      "karma-coverage-istanbul-reporter": "^2.1.1",
      "karma-jasmine": "^3.1.1",
      "karma-jasmine-html-reporter": "^1.5.2",
      "protractor": "~5.4.3",
      "ts-node": "^8.6.2",
      "tslint": "^6.0.0",
      "typescript": "3.7.5"
    },
    "optionalDependencies": {
      "node-sass": "^4.13.1"
    }
  }
  </code></pre>
  
  <p>My tsconfig.json</p>
  
  <pre><code>{
    "compileOnSave": false,
    "angularCompilerOptions": {
      "enableIvy": false
    },
    "compilerOptions": {
      "downlevelIteration": true,
      "importHelpers": true,
      "module": "ESNext",
      "outDir": "./dist/out-tsc",
      "sourceMap": true,
      "declaration": false,
      "moduleResolution": "node",
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "target": "ES6",
      "typeRoots": [
        "node_modules/@types"
      ],
      "lib": [
        "ES2020",
        "ESNext",
        "es6",
        "dom"
      ]
    }
  }
  </code></pre>
  
  <p>Update:</p>
  
  <p>If I put in tsconfig enableIvy as false the error as gone.</p>
  
  <pre><code>"angularCompilerOptions": {
      "enableIvy": false
    },
  </code></pre>
  
  <p>but the CSS not working properly.
  What I should see:</p>
  
  <p><a href="https://i.stack.imgur.com/Y1Pvw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y1Pvw.png" alt="before"></a></p>
  
  <p>and what I see now: (Seems that the float is not working.)</p>
  
  <p><a href="https://i.stack.imgur.com/7IB5a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7IB5a.png" alt="now"></a></p>