dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.

Home Page:https://dot.net/architecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebSPA: An unhandled exception occurred while processing the request.

cosmic-flood opened this issue · comments

I initiated the eShopOnContainer service, and http://host.docker.internal:5100/ was running smoothly. However, http://host.docker.internal:5104/ encountered an error, as shown below.

image

NPM and Node.js have been globally installed with the most recent versions.

Could you help me figure this out?

It should be worked around by following the below steps:

Update Docker file:
Go to the eShopOnContainers\src\Web\WebSPA\Dockerfile

Add the below commands just after the line WORKDIR /app

RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get -y install nodejs
RUN npm install
RUN npm -v

image

Update the environment variable in the docker-compose.override.yml file.
For the webspa service, change the value of ASPNETCORE_ENVIRONMENT variable from Production to Development just like as per below:

  • ASPNETCORE_ENVIRONMENT=Development
    image

It should be worked around by following the below steps:

Update Docker file: Go to the eShopOnContainers\src\Web\WebSPA\Dockerfile

Add the below commands just after the line WORKDIR /app

RUN apt-get update RUN apt-get -y install curl gnupg RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - RUN apt-get -y install nodejs RUN npm install RUN npm -v

image

Update the environment variable in the docker-compose.override.yml file. For the webspa service, change the value of ASPNETCORE_ENVIRONMENT variable from Production to Development just like as per below:

  • ASPNETCORE_ENVIRONMENT=Development
    image

I've already implemented code you mentioned (and also mentioned on wiki page)

If I change RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - to RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -, I got error below.

image

If I change nothing, I got the error of this issue

Hi @ cosmic-flood, I suggest you delete the existing repo and download it again from GitHub. Check for the correct version of npm and node. Try cleaning up the old docker images and building the docker images again. - To build and run the app

  • Go to the /src/ directory and first-time build without cache
docker-compose build --no-cache
  • then, run
docker-compose up sqldata
  • Once it's ready to accept the new connection, you can bring up the other container using the following command from a separate terminal window.
docker-compose up

Let us know if this works for you.

Thank you, I'll try again next week. I'm currently on vacation.