mkcert : The term 'mkcert' is not recognized as the name of a cmdlet, function, script file.

Descripción

Cuando trabajas en tu entorno local utilizando soluciones basadas en contenedorres Docker, como por ejemplo, Ddev con el subsistema de windows WSL2, es posible que tengas que realizar ajustes en tus certificados. Uno de los pasos está relacionado con los certificados mkcert que instala Ddev de manera predeterminada. Si al ejecutar el comando mkcert -CAROOT te devevuelte el error: 

mkcert : The term 'mkcert' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + mkcert -CAROOT + ~~~~~~ + CategoryInfo : ObjectNotFound: (mkcert:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException 

Ese error en PowerShell significa que mkcert no está instalado o no está en el PATH del sistema. Aquí te dejo una guía paso a paso para solucionar este problema en Windows 11:

Instrucciones

1.

 ✅ Instalar mkcert

mkcert no viene instalado por defecto. Para instalarlo:

Opción A: Usar Chocolatey (recomendado)

choco install mkcert

Si no tienes Chocolatey, instala con:

Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
 

Opción B: Descargar manualmente

  1. Ve al repositorio oficial: https://github.com/FiloSottile/mkcert

  2. Entra en "Releases" y descarga el archivo mkcert.exe para Windows.

  3. Colócalo en una carpeta, por ejemplo: C:\tools\mkcert\

  4. Añade esa carpeta al PATH del sistema:

    • Presiona Win + S y escribe "variables de entorno"

    • Selecciona “Editar las variables de entorno del sistema”

    • En la sección de “Variables del sistema”, busca Path > Editar

    • Añade: C:\tools\mkcert\

  5. Cierra y vuelve a abrir PowerShell para que se actualice el entorno.

2. ✅ Verifica que funciona

Escribe en PowerShell:

mkcert --version

 

Si todo está bien, deberías ver algo como:

 
v1.4.4
powershell windows 11 mkcert

 

3. 🚀 Primer uso (crear certificados locales)

mkcert -install
mkcert localhost

Esto crea un certificado local válido para localhost

Más Snippets