美文网首页
TypeError: Cannot read property

TypeError: Cannot read property

作者: 陈程城 | 来源:发表于2019-10-08 20:58 被阅读0次

    TypeError: Cannot read property 'renderRoute' of undefined

     ERROR   /mall/order                                                                                                                   20:47:09
    
    TypeError: Cannot read property 'renderRoute' of undefined
        at Generator.generateRoute (D:\dankal\template\web-mobile-boilerplate\node_modules\@nuxt\generator\dist\generator.js:222:42)
        at Promise.all.routes.splice.map (D:\dankal\template\web-mobile-boilerplate\node_modules\@nuxt\generator\dist\generator.js:120:24)
    

    这是nuxt2.10.0的一个bug

    https://github.com/nuxt/nuxt.js/issues/6500

    解决方案

    package.jsonnuxt改为2.9.1就可以,或者去掉^


    分析步骤:

    1. 查看 package.json
    {
      "name": "testccc2",
      "version": "1.0.0",
      "description": "My flawless Nuxt.js project",
      "author": "“ccc",
      "private": true,
      "scripts": {
        "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
        "build": "nuxt build",
        "start": "cross-env NODE_ENV=production node server/index.js",
        "generate": "nuxt generate",
        "lint": "eslint --ext .js,.vue --ignore-path .gitignore ."
      },
      "dependencies": {
        "nuxt": "^2.6.0",
        "cross-env": "^5.2.0",
        "express": "^4.16.4"
      },
      "devDependencies": {
        "nodemon": "^1.18.9",
        "@nuxtjs/eslint-config": "^1.0.1",
        "@nuxtjs/eslint-module": "^1.0.0",
        "babel-eslint": "^10.0.1",
        "eslint": "^6.1.0",
        "eslint-plugin-nuxt": ">=0.4.2"
      }
    }
    

    此时的nuxt版本为"^2.6.0",2.6.0以上的版本

    1. 查看目录node_modules/nuxt/package.json
    {
      "name": "nuxt",
      "version": "2.10.0",
      "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)",
      "keywords": [
        "nuxt",
        "nuxt.js",
        "nuxtjs",
        "ssr",
        "vue",
        "vue isomorphic",
        "vue server side",
        "vue ssr",
        "vue universal",
        "vue versatile",
        "vue.js",
        "vuejs"
      ],
      "repository": "nuxt/nuxt.js",
      "license": "MIT",
      "contributors": [
        {
          "name": "Sebastien Chopin (@Atinux)"
        },
        {
          "name": "Alexandre Chopin (@alexchopin)"
        },
        {
          "name": "Pooya Parsa (@pi0)"
        },
        {
          "name": "Clark Du (@clarkdo)"
        },
        {
          "name": "Jonas Galvez (@galvez)"
        },
        {
          "name": "Alexander Lichter (@manniL)"
        },
        {
          "name": "Dmitry Molotkov (@aldarund)"
        },
        {
          "name": "Kevin Marrec (@kevinmarrec)"
        },
        {
          "name": "Pim (@pimlie)"
        }
      ],
      "files": [
        "bin",
        "dist"
      ],
      "main": "dist/nuxt.js",
      "bin": "bin/nuxt.js",
      "scripts": {
        "postinstall": "opencollective || exit 0"
      },
      "dependencies": {
        "@nuxt/builder": "2.10.0",
        "@nuxt/cli": "2.10.0",
        "@nuxt/core": "2.10.0",
        "@nuxt/generator": "2.10.0",
        "@nuxt/loading-screen": "^1.2.0",
        "@nuxt/opencollective": "^0.3.0",
        "@nuxt/webpack": "2.10.0"
      },
      "engines": {
        "node": ">=8.9.0",
        "npm": ">=5.0.0"
      },
      "collective": {
        "url": "https://opencollective.com/nuxtjs",
        "logoUrl": "https://opencollective.com/nuxtjs/logo.txt?reverse=true&variant=variant2"
      }
    }
    
    
    

    很明显,nuxt的版本"version": "2.10.0"不是我们想要的

    相关文章

      网友评论

          本文标题:TypeError: Cannot read property

          本文链接:https://www.haomeiwen.com/subject/saeipctx.html