Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: @vue/devtools-core模块报错 #510

Closed
conwel5201 opened this issue Jun 18, 2024 · 7 comments
Closed

[Bug]: @vue/devtools-core模块报错 #510

conwel5201 opened this issue Jun 18, 2024 · 7 comments

Comments

@conwel5201
Copy link

软件版本

NodeJS 18.12.0 pnpm 8.7.0

运行环境

MacOS

运行架构

None

重现步骤

pnpm i
pnpm dev

期望的结果是什么?

正常运行

实际的结果是什么?

import { defineViteServerAction, callViteClientListener, initViteServerContext } from '@vue/devtools-core';
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module '@vue/devtools-core' does not provide an export named 'callViteClientListener'
at ModuleJob.instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadConfigFromBundledFile (file:///Users/kongwei/Conwel/workspace/soybean-admin/node_modules/.pnpm/vite@5.3.1
@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:66913:15)
at async loadConfigFromFile (file:///Users/kongwei/Conwel/workspace/soybean-admin/node_modules/.pnpm/vite@5.3.1_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:66754:24)
at async resolveConfig (file:///Users/kongwei/Conwel/workspace/soybean-admin/node_modules/.pnpm/vite@5.3.1_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:66364:24)
at async createServer (file:///Users/kongwei/Conwel/workspace/soybean-admin/node_modules/.pnpm/vite@5.3.1@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:62977:18)
at async CAC. (file:///Users/kongwei/Conwel/workspace/soybean-admin/node_modules/.pnpm/vite@5.3.1_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/cli.js:735:20)

日志记录(可选)

No response

补充说明(可选)

No response

@oiov
Copy link

oiov commented Jun 18, 2024

运行 pnpm dev 同样的错误,拉取的是 https://github.com/soybeanjs/soybean-admin-nestjs 仓库

  • soybean-admin:1.2.4
  • nodejs: 18.20.3
  • pnpm: 9.3.0
failed to load config from D:\repos\soybean-admin-nestjs\frontend\vite.config.ts
error when starting dev server:
file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite-plugin-vue-devtools@7.2.1_rollup@4.18.0_vite@5.3.0_@types+node@20.14.2_sass@1.77.5__vue@3.4.27_typescript@5.4.5_/node_modules/vite-plugin-vue-devtools/dist/vite.mjs:7
import { defineViteServerAction, callViteClientListener, initViteServerContext } from '@vue/devtools-core';
                                 ^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module '@vue/devtools-core' does not provide an export named 'callViteClientListener'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:191:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadConfigFromBundledFile (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66913:15)
    at async loadConfigFromFile (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66754:24)
    at async resolveConfig (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66364:24)
    at async _createServer (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:62977:18)
    at async CAC.<anonymous> (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/cli.js:735:20)
 ELIFECYCLE  Command failed with exit code 1.

@honghuangdc
Copy link
Member

更新vite-plugin-vue-devtools到最新版本即可,由于该依赖并未锁定所需的@vue/devtools-core的版本,当@vue/devtools-core有更新时,没有lock文件会导致安装现有旧版本的vite-plugin-vue-devtools时会安装新版的@vue/devtools-core
这个新版本有个破坏性更新,将旧版已有的callViteClientListener 导出删掉了,导致报错

@honghuangdc
Copy link
Member

晚点 SoybeanAdmin 更新一下依赖即可

@oiov
Copy link

oiov commented Jun 18, 2024

好滴,我更新了 vite-plugin-vue-devtools: 7.3.1,出现了新的错误:

failed to load config from D:\repos\soybean-admin-nestjs\frontend\vite.config.ts
error when starting dev server:
TypeError: Cannot read properties of undefined (reading 'replace')
    at setupUnocss (file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:67:49)
    at setupVitePlugins (file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:158:5)
    at file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:253:14
    at loadConfigFromFile (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66760:62)
    at async resolveConfig (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66364:24)
    at async _createServer (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:62977:18)
    at async CAC.<anonymous> (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/cli.js:735:20)
 ELIFECYCLE  Command failed with exit code 1.

尝试了删除依赖重新 pnpm i 也不行

@honghuangdc
Copy link
Member

pnpm update-pkg
pnpm cleanup
pnpm i
pnpm dev

@conwel5201
Copy link
Author

好滴,我更新了vite-plugin-vue-devtools: 7.3.1,出现了新的错误:

failed to load config from D:\repos\soybean-admin-nestjs\frontend\vite.config.ts
error when starting dev server:
TypeError: Cannot read properties of undefined (reading 'replace')
    at setupUnocss (file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:67:49)
    at setupVitePlugins (file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:158:5)
    at file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:253:14
    at loadConfigFromFile (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66760:62)
    at async resolveConfig (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66364:24)
    at async _createServer (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:62977:18)
    at async CAC.<anonymous> (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/cli.js:735:20)
 ELIFECYCLE  Command failed with exit code 1.

尝试删除依赖项重新pnpm i也不行

好滴,我更新了vite-plugin-vue-devtools: 7.3.1,出现了新的错误:

failed to load config from D:\repos\soybean-admin-nestjs\frontend\vite.config.ts
error when starting dev server:
TypeError: Cannot read properties of undefined (reading 'replace')
    at setupUnocss (file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:67:49)
    at setupVitePlugins (file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:158:5)
    at file:///D:/repos/soybean-admin-nestjs/frontend/vite.config.ts.timestamp-1718699624383-be3e100d2983a.mjs:253:14
    at loadConfigFromFile (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66760:62)
    at async resolveConfig (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:66364:24)
    at async _createServer (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/chunks/dep-h78lQ5BT.js:62977:18)
    at async CAC.<anonymous> (file:///D:/repos/soybean-admin-nestjs/frontend/node_modules/.pnpm/vite@5.3.0_@types+node@20.14.2_sass@1.77.5/node_modules/vite/dist/node/cli.js:735:20)
 ELIFECYCLE  Command failed with exit code 1.

尝试删除依赖项开始pnpm i也不行

NodeJS: 18.19.0
pnpm: 8.14.0

pnpm update-pkg
pnpm cleanup
pnpm i
pnpm dev

已成功启动无报错

@oiov
Copy link

oiov commented Jun 18, 2024

pnpm update-pkg pnpm cleanup pnpm i pnpm dev

感谢,我也成功运行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants