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
25.17k stars 6.86k forks source link

工程yarn install成功后,无法启动 #1875

Closed mokedeng closed 1 year ago

mokedeng commented 2 years ago

⚠️ 重要 ⚠️ 在进一步操作之前,请检查下列选项。如果您忽视此模板或者没有提供关键信息,您的 Issue 将直接被关闭

描述 Bug

git clone https://github.com/vbenjs/vue-vben-admin.git 克隆代码后,yarn和pnpm都安装成功了,但是yarn dev或pnpm dev均报同样的错: TypeError: Cannot read properties of undefined (reading 'Data') at CodingSource. (/my-code-path/vue-vben-admin/node_modules/vite-plugin-mkcert/dist/mkcert/source.js:116:56) at Generator.next () at fulfilled (/my-code-path/vue3/vue-vben-admin/node_modules/vite-plugin-mkcert/dist/mkcert/source.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:96:5)

复现 Bug

[vue-vben-admin]$ node -v v16.14.2 [vue-vben-admin]$ npm -v 8.5.0 [vue-vben-admin]$ yarn yarn install v1.22.17 info No lockfile found. [1/5] Validating package.json... [2/5] Resolving packages... warning gifsicle > bin-build > tempfile > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning conventional-changelog-cli > tempfile > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning vite-plugin-svg-icons > svg-baker > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated warning vite-plugin-svg-icons > svg-baker > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated warning vite-plugin-svg-icons > svg-baker > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated warning vite-plugin-svg-icons > svg-baker > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated [3/5] Fetching packages... [4/5] Linking dependencies... warning " > vite-plugin-pwa@0.11.13" has unmet peer dependency "workbox-build@^6.4.0". warning " > vite-plugin-pwa@0.11.13" has unmet peer dependency "workbox-window@^6.4.0". [5/5] Building fresh packages... success Saved lockfile. $ husky install husky - Git hooks installed Done in 264.67s. [vue-vben-admin]$ yarn dev yarn run v1.22.17 $ vite

ERROR error when starting dev server: 16:44:38 TypeError: Cannot read properties of undefined (reading 'Data') at CodingSource. (/my-code-path/vue-vben-admin/node_modules/vite-plugin-mkcert/dist/mkcert/source.js:116:56) at Generator.next () at fulfilled (/my-code-path/vue-vben-admin/node_modules/vite-plugin-mkcert/dist/mkcert/source.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:96:5)

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

系统信息

AuroraYolo commented 2 years ago

我也是

wdlnydhcg commented 2 years ago

和你类似,不过是这样

failed to load config from /Volumes/workspace/temp/xxx/vite.config.ts error when starting dev server: TypeError: Cannot read properties of undefined (reading 'endsWith') at configHtmlPlugin (/Volumes/workspace/temp/xxx/vite.config.ts:344:34) at createVitePlugins (/Volumes/workspace/temp/xxx/vite.config.ts:662:20) at vite_config_default (/Volumes/workspace/temp/xxx/vite.config.ts:740:14) at loadConfigFromFile (/Volumes/workspace/temp/xxx/node_modules/.pnpm/vite@2.6.13_less@4.1.2/node_modules/vite/dist/node/chunks/dep-85dbaaa7.js:68641:15) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async resolveConfig (/Volumes/workspace/temp/xxx/node_modules/.pnpm/vite@2.6.13_less@4.1.2/node_modules/vite/dist/node/chunks/dep-85dbaaa7.js:68185:28) at async createServer (/Volumes/workspace/temp/xxx/node_modules/.pnpm/vite@2.6.13_less@4.1.2/node_modules/vite/dist/node/chunks/dep-85dbaaa7.js:66699:20) at async CAC. (/Volumes/workspace/temp/xxx/node_modules/.pnpm/vite@2.6.13_less@4.1.2/node_modules/vite/dist/node/cli.js:687:24)

wdlnydhcg commented 2 years ago

我解决了这个问题,不知道我的解决方法是否适用你们。我是因为一些隐藏文件(.开头的文件)的缺失导致。

mokedeng commented 2 years ago

我解决了这个问题,不知道我的解决方法是否适用你们。我是因为一些隐藏文件(.开头的文件)的缺失导致。

你咋解决的?

AuroraYolo commented 2 years ago

我下载的是简约版本的

uncarbon97 commented 2 years ago

pnpm install 试一下?

GitHubWuYi commented 2 years ago

遇到了同样的问题,怎么解决?

GitHubWuYi commented 2 years ago

遇到了同样的问题,怎么解决?

去掉https配置,成功启动了。

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