vue.js - Vue 3 包更新错误

标签 vue.js webpack vuejs3

Vue 3 应用程序在软件包更新后损坏/无法编译。更新前零错误。
我收到以下节点控制台错误。
错误

"export 'createElementBlock' (imported as '_createElementBlock') was not found in 'vue'
"export 'createElementVNode' (imported as '_createElementVNode') was not found in 'vue'
"export 'normalizeClass' (imported as '_normalizeClass') was not found in 'vue'

更多信息...:class抛出 normalizeClass 错误。
浏览器错误
Uncaught TypeError: Object(...) is not a function
    at eval (App.vue?3dfd:2)
    at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader-v16/dist/templateLoader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/App.vue?vue&type=template&id=7ba5bd90 (app.js:1091)
    at __webpack_require__ (app.js:854)
    at fn (app.js:151)
    at eval (App.vue?2083:1)
    at Module../src/App.vue?vue&type=template&id=7ba5bd90 (app.js:1310)
    at __webpack_require__ (app.js:854)
    at fn (app.js:151)
    at eval (App.vue?eabf:1)
    at Module../src/App.vue (app.js:1274)

package.json
  "dependencies": {
    "@stripe/stripe-js": "^1.17.0",
    "core-js": "^3.16.1",
    "date-fns": "^2.23.0",
    "firebase": "^8.9.1",
    "register-service-worker": "^1.7.2",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.13",
    "@vue/cli-plugin-pwa": "~4.5.13",
    "@vue/cli-plugin-router": "~4.5.13",
    "@vue/cli-plugin-typescript": "~4.5.13",
    "@vue/cli-plugin-vuex": "~4.5.13",
    "@vue/cli-service": "~4.5.13",
    "@vue/compiler-sfc": "^3.2.2",
    "sass": "^1.37.5",
    "sass-loader": "^10",
    "typescript": "~4.3.5"
  }
近期升级
@vue/cli-plugin-babel               ~4.5.0  →  ~4.5.13
@vue/cli-plugin-pwa                 ~4.5.0  →  ~4.5.13
@vue/cli-plugin-router              ~4.5.0  →  ~4.5.13
@vue/cli-plugin-typescript          ~4.5.0  →  ~4.5.13
@vue/cli-plugin-vuex                ~4.5.0  →  ~4.5.13
@vue/cli-service                    ~4.5.0  →  ~4.5.13
@vue/compiler-sfc                   ^3.0.0  →   ^3.2.2
sass                               ^1.26.5  →  ^1.37.5
sass-loader                         ^8.0.2  →  ^10.2.0
typescript                          ~4.1.5  →   ~4.3.5
@stripe/stripe-js                  ^1.16.0  →  ^1.17.0
core-js                             ^3.6.5  →  ^3.16.1
firebase                            ^8.6.7  →   ^8.9.1
register-service-worker             ^1.7.1  →   ^1.7.2

最佳答案

我用以下方法解决了我的问题:

  • rm -rf node_modules/
  • rm package-lock.json
  • npm cache verify
  • npm i && npm up

  • 如果使用 sass,请通过 package.json 锁定版本。"sass-loader": "^10" .

    关于vue.js - Vue 3 包更新错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68795955/

    相关文章:

    javascript - 是否有类似附件的垂直盖流 slider ?

    javascript - Vue react 性 : Computed changes data but then is not reacting to it

    vue.js - Vue3 组合 api watch 存储值

    node.js - 使用 package.json 一起运行 Node 服务器和 webpack

    vue.js - 将 "detect click outside"自定义指令从 Vue 2 迁移到 Vue 3

    javascript - Vue 3 组合 API 数据()函数

    node.js - Vuesax 4 错误 : Cannot find module 'chalk'

    javascript - 破坏 Chrome 缓存以进行浏览器同步重新加载

    javascript - Node.js fs 解决方法

    vue.js - 如何在 vee-validate 中使用 <select>?