首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Nuxt错误:nodeOps.tagName(.)在Vue框架的“createPatchFunction”中未定义

Nuxt错误:nodeOps.tagName(.)在Vue框架的“createPatchFunction”中未定义
EN

Stack Overflow用户
提问于 2021-08-25 06:34:07
回答 2查看 684关注 0票数 2

在我的nuxt应用程序中,在使用this.$router.push({ path: '/path' })改变路由后,我在火狐中获得了nodeOps.tagName(...) is undefined,在chrome中我得到了cannot get access to .toLowerCase() of undefined

它发生在createPatchFunction of vue.runtime.esm.js版本:nuxt:^2.14.12, vue:^2.6.12中。

代码语言:javascript
复制
function createPatchFunction (backend) {
  // ...
  // some more vue framework code here
  // ...
  function emptyNodeAt (elm) {
    // the following line throws error and app crashes
    return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  }
}

更新:-- elm参数是html注释类型。

更新-2: package.jsonnuxt.config.js文件:

代码语言:javascript
复制
{
  "name": "name",
  "version": "1.0.0",
  "scripts": {
    "build": "nuxt build",
    "test": "jest",
    "dev": "nuxt",
    "generate": "nuxt generate",
    "start": "nuxt start"
  },
  "dependencies": {
    "@chenfengyuan/vue-number-input": "^1.2.1",
    "@nuxt/content": "^1.5.0",
    "@nuxtjs/axios": "^5.12.4",
    "@nuxtjs/gtm": "^2.4.0",
    "@nuxtjs/proxy": "^2.1.0",
    "nuxt": "^2.14.12",
    "vue": "^2.6.12",
    "vue-multiselect": "^2.1.6",
    "vue-numeric-input": "^1.0.6",
    "vuex-pathify": "^1.4.4"
  },
  "devDependencies": {
    "@babel/core": "7.12.17",
    "@babel/preset-env": "7.12.17",
    "@nuxtjs/style-resources": "^1.0.0",
    "@nuxtjs/svg": "^0.1.12",
    "@nuxtjs/vuetify": "^1.11.2",
    "@vue/cli-plugin-unit-jest": "^4.5.13",
    "@vue/test-utils": "^1.2.2",
    "babel-core": "^7.0.0-bridge.0",
    "babel-jest": "^27.0.6",
    "eslint": "^7.25.0",
    "eslint-plugin-vue": "^7.9.0",
    "jest": "^27.0.6",
    "vue-jest": "^3.0.7",
    "vue-svg-loader": "^0.16.0",
    "vue-template-compiler": "^2.6.12"
  }
}

nuxt.config.js

代码语言:javascript
复制
import colors from "vuetify/es5/util/colors";

export default {
  mode: "universal",
  target: "static",
  css: ["@/assets/scss/global.scss"],
  plugins: [
    "~/plugins/api/index.js",
    "~/plugins/sassVaribles/index.js",
    "~/plugins/datePicker/index.client.js",
    "~/plugins/globalComponents.js",
  ],
  components: false,
  buildModules: ["@nuxtjs/vuetify", "@nuxtjs/style-resources"],
  modules: [
    "@nuxtjs/axios",
    "@nuxt/content",
    "@nuxtjs/svg",
    "@nuxtjs/proxy"
  ],
  styleResources: {
    scss: ["@/assets/scss/main.scss"]
  },
  env: {
  },
  server: {
    port: 8089,
    host: "0.0.0.0"
  },
  axios: {
    baseURL: ""
  },
  vuetify: {
    customVariables: ["~/assets/variables.scss"],
    rtl: false,
    theme: {
      dark: false,
      default: "light",
      disable: false,
      options: {
        customProperties: true,
        variations: true
      },
      themes: {
        light: {
          primary: "#5050a0",
          accent: colors.grey.darken3,
          secondary: colors.amber.darken3,
          info: "#dddcec",
          warning: colors.amber.base,
          error: colors.deepOrange.accent4,
          success: colors.green.accent3
        },
        dark: {
          primary: colors.blue.darken2,
          accent: colors.grey.darken3,
          secondary: colors.amber.darken3,
          info: colors.teal.lighten1,
          warning: colors.amber.base,
          error: colors.deepOrange.accent4,
          success: colors.green.accent3
        },
        custom: {
          color: {
            background: {
              default: "#fff",
              paper: "#fff",
              paperOverlay: "#fff"
            },
            text: {
              primary: "#000",
              secondary: "rgba(0, 0, 0, 0.7)",
              disabled: "rgba(0, 0, 0, 0.5)",
              hint: "rgba(0, 0, 0, 0.5)",
              icon: "rgba(0, 0, 0, 0.5)"
            }
          }
        }
      }
    }
  },
};
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-03-02 09:02:05

获得Nuxt error : nodeOps.tagName(...)和以下vm undefined错误:[Vue warn]: Error in render: "TypeError: _vm is undefined" (found in )

在我的组件中用v-if替换了v-show之后,它得到了解决,在组件中,我一直在提取服务器端的异步数据,并使用vuex getter(状态也修改了服务器端)来修改模板。

票数 2
EN

Stack Overflow用户

发布于 2021-08-25 12:24:30

看起来你有一个老版本的Node?https://github.com/nuxt/nuxt.js/issues/2385#issuecomment-358111543

尝试升级到最新的LTS,又名14,并再次检查您是否得到了最新版本的Nuxt。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68917917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档