microsoft / microsoft/aspire

Aspire not working with REACT Application

Open
#7,277 10 comments 0 reactions 0 assignees View on GitHub
area-tooling
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Aspire doesn't seem to want to work with a Visual Studio generated REACT application. There are no endpoints in the Aspire portal for the app. I have to manually open a browser and type in the Url to open the application. I can live with that, if this just isn't something that was ever intended, for Aspire, but it seems like this should work.

By the way, thanks in advance. Aspire is an awesome tool.

### Expected Behavior

I expected the endpoint(s) for the REACT app to be listed in the "endpoints" column of the Aspire portal.

### Steps To Reproduce

Here is a quick git with code for the problem: https://github.com/martycook/AspireApp1

I started with an out-of-the-box solution generated with the ".NET Aspire Empty App" project template. Then I added an out-of-the-box REACT application to that solution using the "React App" (javascript) project template. Then I added the "Aspire.Hosting.NodeJs" nuget package to the AspireApp1.AppHost project. Then I added this line to the Program.cs of the AspireApp1.AppHost project: builder.AddNpmApp("reactproject1", "../reactproject1", "dev").WithExternalHttpEndpoints(); When I build and run the solution I don't see any errors but I also don't see the endpoints.

### Exceptions (if any)

This is the startup log for the REACT app, from the Aspire console logs window:

2025-01-27T16:50:29
2025-01-27T16:50:29 > reactproject1@0.0.0 dev
2025-01-27T16:50:29 > vite
2025-01-27T16:50:29
2025-01-27T16:50:30
2025-01-27T16:50:30 VITE v6.0.11 ready in 252 ms
2025-01-27T16:50:30
2025-01-27T16:50:30 ➜ Local: http://localhost/:54358/
2025-01-27T16:50:30 ➜ Network: use --host to expose

### .NET Version info

Microsoft Windows [Version 10.0.26100.2894]
(c) Microsoft Corporation. All rights reserved.

C:\Users\marti>dotnet --info
.NET SDK:
Version: 9.0.200-preview.0.24575.35
Commit: 81b5f040be
Workload version: 9.0.200-manifests.4a54b1a6
MSBuild version: 17.13.0-preview-24569-04+8f6b8ad0a

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.200-preview.0.24575.35\

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.1
Architecture: x64
Commit: c8acea2262

.NET SDKs installed:
8.0.303 [C:\Program Files\dotnet\sdk]
8.0.403 [C:\Program Files\dotnet\sdk]
9.0.101 [C:\Program Files\dotnet\sdk]
9.0.102 [C:\Program Files\dotnet\sdk]
9.0.200-preview.0.24575.35 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

### Anything else?

.NET SDK: 9.0.200-preview.0.24575.35
IDE: Visual Studio Version 17.12.4

Aspire.Hosting.AppHost: 9.0.0
Aspire.Hosting.NodeJs: 9.0.0

Microsoft.VisualStudio.JavaScript.Sdk/1.0.1738743

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.