vueComponent / ant-design-vue

🌈 An enterprise-class UI components based on Ant Design and Vue. 🐜
https://antdv.com/
Other
20.31k stars 3.79k forks source link

V3升级V4后项目启动报错:Cannot find module 'ant-design-vue/dist/theme #7398

Closed RealCharlesChia closed 5 months ago

RealCharlesChia commented 8 months ago

Version

4.1.0

Environment

ant-design-vue: 4.1.2, os: Win11, vue: 3.3.4

Reproduction link

https://www.antdv.com/docs/vue/migration-v4-cn

Steps to reproduce

项目原先antd版本为3.2.20,根据文档迁移至4.1.2

What is expected?

升级成功,正常启动

What is actually happening?

启动失败,报错

failed to load config from D:\Program_manage\2023\thimop\monitorfe\vite.config.mts
error when starting dev server:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'D:\Program_manage\2023\thimop\monitorfe\node_modules\ant-design-vue\dist\theme' imported from D:\Program_manage\2023\thimop\monitorfe\vite.config.mts.timestamp-1709538334794-327a43b05e74c.mjs
at new NodeError (node:internal/errors:399:5)
at finalizeResolution (node:internal/modules/esm/resolve:326:11)
at moduleResolve (node:internal/modules/esm/resolve:945:10)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36)
ELIFECYCLE  Command failed with exit code 1.

查看了一下,删除重新install的node_modules中的ant-design-vue确实没有ant-design-vue\dist\theme,V4版是取消了这个theme吗?那之前项目框架中引用到的怎么办?

RealCharlesChia commented 8 months ago

目前package.json主要部分:

  "dependencies": {
    "@ant-design/colors": "^7.0.0",
    "@ant-design/icons-vue": "^7.0.1",
    "@iconify/iconify": "^3.1.0",
    "@logicflow/core": "^1.2.22",
    "@logicflow/extension": "^1.2.22",
    "@vue/runtime-core": "^3.3.4",
    "@vue/shared": "^3.4.19",
    "@vueuse/core": "^10.7.2",
    "@vueuse/shared": "^10.7.2",
    "@zxcvbn-ts/core": "^3.0.4",
    "ant-design-vue": "^4.1.2",
    "axios": "^1.6.7",
    "codemirror": "^5.65.3",
    "cropperjs": "^1.6.1",
    "crypto-js": "^4.2.0",
    "dayjs": "^1.11.10",
    "echarts": "^5.4.2",
    "element-resize-detector": "^1.2.4",
    "file-saver": "^2.0.5",
    "intro.js": "^7.0.1",
    "js-yaml": "^4.1.0",
    "lodash-es": "^4.17.21",
    "mockjs": "^1.1.0",
    "nprogress": "^0.2.0",
    "path-to-regexp": "^6.2.1",
    "pinia": "^2.1.7",
    "pinia-plugin-persistedstate":"^3.2.1",
    "pnpm": "^8.5.1",
    "print-js": "^1.6.0",
    "qrcode": "^1.5.3",
    "qs": "^6.11.2",
    "resize-observer-polyfill": "^1.5.1",
    "showdown": "^2.1.0",
    "sortablejs": "^1.15.0",
    "splitpanes": "^3.1.5",
    "tinymce": "^5.10.9",
    "vditor": "^3.9.9",
    "vis": "4.21.0-EOL",
    "vis-network": "^9.1.6",
    "vue": "3.3.4",
    "vue-grid-layout": "3.0.0-beta1",
    "vue-i18n": "^9.9.1",
    "vue-json-pretty": "^2.3.0",
    "vue-router": "^4.2.5",
    "vue-types": "^5.1.1",
    "x2js": "^3.4.4",
    "xlsx": "^0.18.5"
  },
  "devDependencies": {
    "@commitlint/cli": "^19.0.3",
    "@commitlint/config-conventional": "^19.0.3",
    "@iconify/json": "^2.2.183",
    "@purge-icons/generated": "^0.10.0",
    "@types/codemirror": "^5.60.15",
    "@types/crypto-js": "^4.2.2",
    "@types/fs-extra": "^11.0.1",
    "@types/inquirer": "^9.0.3",
    "@types/intro.js": "^5.1.1",
    "@types/lodash-es": "^4.17.12",
    "@types/mockjs": "^1.0.10",
    "@types/node": "^20.11.24",
    "@types/nprogress": "^0.2.3",
    "@types/qrcode": "^1.5.5",
    "@types/qs": "^6.9.11",
    "@types/showdown": "^2.0.6",
    "@types/sortablejs": "^1.15.8",
    "@typescript-eslint/eslint-plugin": "^7.1.0",
    "@typescript-eslint/parser": "^7.1.0",
    "@vitejs/plugin-vue": "^5.0.4",
    "@vitejs/plugin-vue-jsx": "^3.1.0",
    "@vue/compiler-sfc": "^3.3.4",
    "@vue/test-utils": "^2.3.2",
    "autoprefixer": "^10.4.14",
    "conventional-changelog-cli": "^4.1.0",
    "cross-env": "^7.0.3",
    "cz-git": "^1.6.1",
    "czg": "^1.6.1",
    "dotenv": "^16.0.3",
    "eslint": "^8.41.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-prettier": "^5.1.3",
    "eslint-plugin-vue": "^9.13.0",
    "esno": "^4.7.0",
    "fs-extra": "^11.1.1",
    "husky": "^9.0.11",
    "inquirer": "^9.2.6",
    "less": "^4.1.3",
    "lint-staged": "^15.2.2",
    "picocolors": "^1.0.0",
    "postcss": "^8.4.23",
    "postcss-html": "^1.5.0",
    "postcss-less": "^6.0.0",
    "prettier": "^3.2.5",
    "rimraf": "^5.0.1",
    "rollup": "^4.12.0",
    "rollup-plugin-visualizer": "^5.9.0",
    "stylelint": "^16.2.1",
    "stylelint-config-recommended": "^14.0.0",
    "stylelint-config-recommended-vue": "^1.4.0",
    "stylelint-config-standard": "^36.0.0",
    "stylelint-order": "^6.0.3",
    "terser": "^5.17.4",
    "ts-node": "^10.9.1",
    "typescript": "^5.3.3",
    "unplugin-vue-setup-extend-plus": "^1.0.0",
    "vite": "^5.1.3",
    "vite-plugin-compression": "^0.5.1",
    "vite-plugin-mkcert": "^1.15.0",
    "vite-plugin-mock": "^3.0.1",
    "vite-plugin-progress": "^0.0.7",
    "vite-plugin-purge-icons": "^0.10.0",
    "vite-plugin-pwa": "^0.19.2",
    "vite-plugin-style-import": "^2.0.0",
    "vite-plugin-svg-icons": "^2.0.1",
    "vite-plugin-windicss": "^1.9.3",
    "vite-vue-plugin-html": "^1.0.1",
    "vite-vue-plugin-theme": "^1.0.0",
    "vue-eslint-parser": "^9.3.0",
    "vue-tsc": "^2.0.4"
  },
MollyBai commented 7 months ago

我也遇到了,请问解决了吗

MollyBai commented 7 months ago

企业微信截图_17128187366512 我看这个解决了

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days