Hi. I've got a solution I created in Visual Studio using the "Vue and ASP.Net Core" template. This creates two projects in a single solution. One for the frontend (in this case Vue with TypeScript) and one for the server side (C# WebAPI).
I've created the pipeline below to automate builds/deploys, but I get the error "Node.js is required to build and run this project". Any ideas on what I need to change? It seems I should be able to change to an image that includes both the .Net SDK and Node, but I have found an image that works so far.
Thanks
Andy
Hi Andy,
The official mcr.microsoft.com/dotnet/sdk
images (like dotnet/sdk:9.0
) do not include Node.js. This is a common issue for ASP.NET Core templates with a JavaScript frontend (Vue, React, Angular), since the .NET build expects Node.js for frontend asset compilation.
There are a couple solutions here:
1. Install Node.js as part of your build script:
curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt-get install -y nodejs
FROM mcr.microsoft.com/dotnet/sdk:9.0
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \ && apt-get install -y nodejs
Cheers!
- Ben (Bitbucket Cloud Support)
Hi Ben
Thanks for the response. I think you're second solution is the correct long term answer, however in the meantime I've found a suitable existing image on docker hub:
mathieu79/dotnet-sdk-nodejs-webpack:9.0.300-alpine
Image Layer Details - mathieu79/dotnet-sdk-nodejs-webpack:9.0.300-alpine | Docker Hub
Thanks
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.