vue-vben-admin icon indicating copy to clipboard operation
vue-vben-admin copied to clipboard

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

Open mokedeng opened this issue 2 years ago • 9 comments

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

  • [x] 已阅读 文档.
  • [x] 确保您的代码已是最新或者所报告的 Bug 在最新版本中可以重现. (部分 Bug 可能已经在最近的代码中修复)
  • [x] 已在 Issues 中搜索了相关的关键词
  • [x] 不是 ant design vue 组件库的 Bug

描述 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 > [email protected]: 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 > [email protected]: 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 > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated warning vite-plugin-svg-icons > svg-baker > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated warning vite-plugin-svg-icons > svg-baker > micromatch > snapdragon > source-map-resolve > [email protected]: See https://github.com/lydell/source-map-url#deprecated warning vite-plugin-svg-icons > svg-baker > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated [3/5] Fetching packages... [4/5] Linking dependencies... warning " > [email protected]" has unmet peer dependency "workbox-build@^6.4.0". warning " > [email protected]" 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.

系统信息

  • 操作系统: centos
  • Node 版本: v16.14.2
  • npm 版本:8.5.0
  • yarn 版本:1.22.17
  • pnpm 版本:7.0.0

mokedeng avatar May 05 '22 08:05 mokedeng

我也是

AuroraYolo avatar May 05 '22 11:05 AuroraYolo

和你类似,不过是这样

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/[email protected][email protected]/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/[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-85dbaaa7.js:68185:28) at async createServer (/Volumes/workspace/temp/xxx/node_modules/.pnpm/[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-85dbaaa7.js:66699:20) at async CAC. (/Volumes/workspace/temp/xxx/node_modules/.pnpm/[email protected][email protected]/node_modules/vite/dist/node/cli.js:687:24)

wdlnydhcg avatar May 09 '22 02:05 wdlnydhcg

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

wdlnydhcg avatar May 09 '22 03:05 wdlnydhcg

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

你咋解决的?

mokedeng avatar May 09 '22 06:05 mokedeng

我下载的是简约版本的

AuroraYolo avatar May 09 '22 08:05 AuroraYolo

pnpm install 试一下?

uncarbon97 avatar Jul 05 '22 01:07 uncarbon97

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

GitHubWuYi avatar Jul 07 '22 09:07 GitHubWuYi

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

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

GitHubWuYi avatar Jul 08 '22 01:07 GitHubWuYi

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

yurenzhen avatar Sep 06 '22 10:09 yurenzhen