Mostly it could be because, you haven't installed the dotnet core yet, which seems to be required prior to installing the asp.net core spa template. To check if you have installed the .net core in your machine or not, check if this exists
C:\Program Files\dotnet\sdk
or just type following in command prompt
dotnet --version
The above command should show you the version of .net core installed.
If still says, 'dotnet' is not recognized then you need to install it.
Follow the detailed steps from following official link to get it installed.
.NET and C# - Get Started in 10 Minutes[
^]
If you find that dotnet core is already installed, please try to open Visual studio as Administrator and see if that helps.
Please let me know if nothing suggested works for you.
Hope, it helps :)