vbenjs / vue-vben-admin

A modern vue admin panel built with Vue3, Shadcn UI, Vite, TypeScript, and Monorepo. It's fast!
https://www.vben.pro
MIT License
24.73k stars 6.72k forks source link

yarn dev启动报错 #1916

Closed wanggouzi closed 1 year ago

wanggouzi commented 2 years ago

克隆下来以后用yarn安装了依赖 使用yarn dev启动的时候报下面的错误 failed to load config from xxxxxxx\vbenAdmin\vue-vben-admin\vite.config.ts error when starting dev server: TypeError: process$1.homedir is not a function at Object. (xxxxxxx\vbenAdmin\vue-vben-admin\node_modules\vite-plugin-mkcert\dist\mkcert.cjs.js:47:50) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (xxxxxxx\vbenAdmin\vue-vben-admin\vite.config.ts:367:41) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.require.extensions. [as .ts] (xxxxxxx\vbenAdmin\vue-vben-admin\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:61924:20) error Command failed with exit code 1. 求救!小白不懂为什么

sbcdyb123 commented 2 years ago

+1

sbcdyb123 commented 2 years ago

image

sbcdyb123 commented 2 years ago

我用pnpm安装 然后可以启动,yarn安装就启动不了

wanggouzi commented 2 years ago

我用pnpm安装 然后可以启动,yarn安装就启动不了

对对对 我看的https://vvbin.cn/doc-next 官方文档用的yarn装的,github是pnpm,不知道yarn装的哪一步出了问题

hddlly commented 2 years ago

确实很迷 官方文档用的yarn装的,github是pnpm 跑不起来啊

wzxinchen commented 2 years ago

我就直接 yarn,然后一路下来没啥问题

wanggouzi commented 2 years ago

我全程用了pnpm就没问题了

jareygu commented 2 years ago

是不是node版本问题 要求12.x及以上 且不能是13.x

uncarbon97 commented 2 years ago

一开始用 2.3.0 二开是还是yarn 现在没有 release 版,直接用 main 分支的话,IDEA 打开项目直接提示用 pnpm 了

是哪次版本改了?

yurenzhen commented 2 years ago

这是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",
    // 其他配置...
  }
}