首页 > 解决方案 > 如何在 Vue.js 中获取正确的详细调试消息?

问题描述

我正在尝试调试我的 VueJs3 应用程序。我经常发现控制台中显示的调试消息是神秘且不具体的。这是我最近收到的一个例子:

runtime-core.esm-bundler.js?5c40:958 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'emitsOptions')
    at shouldUpdateComponent (runtime-core.esm-bundler.js?5c40:958)
    at updateComponent (runtime-core.esm-bundler.js?5c40:4448)
    at processComponent (runtime-core.esm-bundler.js?5c40:4402)
    at patch (runtime-core.esm-bundler.js?5c40:3993)
    at patchBlockChildren (runtime-core.esm-bundler.js?5c40:4307)
    at patchElement (runtime-core.esm-bundler.js?5c40:4215)
    at processElement (runtime-core.esm-bundler.js?5c40:4073)
    at patch (runtime-core.esm-bundler.js?5c40:3990)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js?5c40:4608)
    at ReactiveEffect.run (reactivity.esm-bundler.js?a1e9:160)

不幸的是,这些消息无助于缩小对象为空的特定组件或行。事实上,这些行没有引用我的任何文件。我确实安装了 Vue Chrome 扩展,但没有显示任何调试信息。我习惯于使用 python/django,其中异常会触发漂亮的堆栈跟踪级联,这有助于轻松调试错误。我如何才能更有效率地解决 Vue 中的错误?

标签: vue.js

解决方案


推荐阅读