Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining AspNetCoreHostingModel in csproj throws Failed to start 'npm' exception

Tags:

asp.net-core

The ASP.NET Core 2.2 update has this new AspNetCoreHostingModel property that can be set to InProcess or OutOfProccess. If I add the property in the csproj and it doesn't matter to which option I set, I get the following error:

AggregateException: One or more errors occurred. (One or more errors occurred. (Failed to start 'npm'. To resolve this:
[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
Current PATH enviroment variable is: (there are some 20 paths before this last one);C:\Program Files\nodejs;
Make sure the executable is in one of those directories, or update your PATH.

The path to npm is already stated there, so what else can be the problem?

like image 477
GregoryHouseMD Avatar asked Dec 09 '18 20:12

GregoryHouseMD


1 Answers

I added "AspNetCoreModule" to PropertyGroup and it worked.

<PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>

reference: https://blogs.msdn.microsoft.com/webdev/2018/12/04/asp-net-core-2-2-available-today/

like image 107
Jason Chen Avatar answered Nov 13 '22 17:11

Jason Chen