在我运行pnpm install安装完依赖之后,运行pnpm run serve时,出现:
ERROR error when starting dev server: 09:26:09
Error: Command failed: "/home/xxxx/.vite-plugin-mkcert/mkcert" -install -key-file "/home/xxxx/.vite-plugin-mkcert/certs/dev.key" -cert-file "/home/xxxx/.vite-plugin-mkcert/certs/dev.pem" localhost 127.0.0.1 172.16.143.1 192.168.198.1 192.168.30.208 172.17.0.1
The local CA is already installed in the system trust store! 👍
ERROR: failed to execute "certutil -A -d dbm:/home/xxxx/.mozilla/firefox/572vi0hv.default": exit status 255
certutil: function failed: SEC_ERROR_LEGACY_DATABASE: The certificate/key database is in an old, unsupported format.
at ChildProcess.exithandler (child_process.js:383:12)
at ChildProcess.emit (events.js:400:28)
at maybeClose (internal/child_process.js:1088:16)
at Socket.<anonymous> (internal/child_process.js:446:11)
at Socket.emit (events.js:400:28)
at Pipe.<anonymous> (net.js:686:12)
ELIFECYCLE Command failed with exit code 1.
System Info
- Operating System: ArchLinux x86_64 5.15.71-1-lts
- Node version: v14.20.0
- Package manager (npm/yarn/pnpm) and version: pnpm 7.11.0
1条答案
按热度按时间k97glaaz1#
这是vite-plugin-mkcert 遇上 vite.config.ts文件里面的server.https: true时, 没有mkcert https证书所导致的问题,
一些人建议更改vite.config.ts文件里面的server.https值为false, 其实, 更优雅的做法是:
直接在命令行启动参数增加 --https false 即可, 例如:
yarn dev --https false
pnpm dev --https false
cnpm dev --https false
npm dev --https false
或者你修改package.json里面的scripts dev脚本也行
{
"scripts": {
//其他配置...
"dev": "vite --https false",
// 其他配置...
}
}