GregoryHouseMD
GregoryHouseMD

Reputation: 2378

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

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?

Upvotes: 7

Views: 2922

Answers (1)

Jason Chen
Jason Chen

Reputation: 166

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/

Upvotes: 4

Related Questions