liuweiGL / vite-plugin-mkcert

Provide certificates for vite's https dev service.
https://www.npmjs.com/package/vite-plugin-mkcert
MIT License
541 stars 37 forks source link

Failed to execute certutil #69

Closed valentin- closed 1 year ago

valentin- commented 1 year ago

Describe the bug

Hi, running vite throws following error. I'm not sure if this is a local issue or related to the mkcert plugin.

mkcert

As a workaround I renamed /etc/pki/nssdb, run vite and generate the certificates, revert folder renaming.

Did you experience this issue and got a better solution?

Thanks!

Reproduction

System Info

Output of npx envinfo --system --npmPackages vite,vite-plugin-mkcert --binaries --browsers:

System:
    OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 12.44 GB / 31.08 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
  Browsers:
    Chrome: 114.0.5735.90
  npmPackages:
    vite: ^4.3.6 => 4.3.6 
    vite-plugin-mkcert: ^1.15.0 => 1.15.0 

Used package manager:

Logs


liuweiGL commented 1 year ago

I have no idea about this,please refer to https://github.com/FiloSottile/mkcert/issues

janein commented 1 year ago

I'm running into the same issue on Ubuntu.

The local CA is already installed in the system trust store! 👍
ERROR: failed to execute "certutil -A -d sql:/etc/pki/nssdb": exit status 255

certutil: function failed: SEC_ERROR_BAD_DATABASE: security library: bad database.

    at ChildProcess.exithandler (node:child_process:419:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)

node: 18.16.0 npm: 9.6.7 vite: 4.3.6 vite-plugin-mkcert: 1.15.0

When i try to manually run mkcert -install I get this error:

Created a new local CA 💥
The local CA is now installed in the system trust store! ⚡️
ERROR: failed to execute "certutil -A -d sql:/etc/pki/nssdb": exit status 255

certutil: function failed: SEC_ERROR_BAD_DATABASE: security library: bad database.

So it seems like an issue with mkcert itself.

janein commented 1 year ago

This helped me to get it running: https://github.com/FiloSottile/mkcert/issues/83#issuecomment-438428315