According to this link, there is a bug in new versions of .NET where the certificate folder is not automatically created.
The workaround is to add the following code in the aspnetcore-https.js file:
const baseFolder =
//...
s.mkdirSync(baseFolder, { recursive: true });