nuxt-community / nuxtent-module

Seamlessly use content files in your Nuxt.js sites.
https://nuxtent-module.netlify.com/guide
MIT License
388 stars 50 forks source link

TypeError: Cannot read property 'name' of undefined - multiple content example #92

Closed STnetwork closed 7 years ago

STnetwork commented 7 years ago

Hi,

I updated the module with the 1.0.2 version, I have this message when I generate with the multiple-content example:

==== Error report ==== 
Route: '/archives'
TypeError: Cannot read property 'name' of undefined
    at normalizeLocation (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-router/dist/vue-router.common.js:1231:11)
    at VueRouter.resolve (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-router/dist/vue-router.common.js:2458:18)
    at VueComponent.render (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-router/dist/vue-router.common.js:371:22)
    at VueComponent.Vue._render (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue/dist/vue.runtime.common.js:4193:22)
    at renderComponentInner (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:7017:25)
    at renderComponent (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:6987:5)
    at RenderContext.renderNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:6903:5)
    at RenderContext.next (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2193:14)
    at cachedWrite (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2053:9)
    at renderStringNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:7095:5)
    at RenderContext.renderNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:6901:5)
    at RenderContext.next (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2193:14)
    at cachedWrite (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2053:9)
    at renderStringNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:7095:5)
    at RenderContext.renderNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:6901:5)
    at RenderContext.next (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2193:14)

Route: '/projects'
TypeError: Cannot read property 'name' of undefined
    at normalizeLocation (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-router/dist/vue-router.common.js:1231:11)
    at VueRouter.resolve (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-router/dist/vue-router.common.js:2458:18)
    at VueComponent.render (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-router/dist/vue-router.common.js:371:22)
    at VueComponent.Vue._render (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue/dist/vue.runtime.common.js:4193:22)
    at renderComponentInner (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:7017:25)
    at renderComponent (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:6987:5)
    at RenderContext.renderNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:6903:5)
    at RenderContext.next (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2193:14)
    at cachedWrite (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2053:9)
    at renderStringNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:7095:5)
    at RenderContext.renderNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:6901:5)
    at RenderContext.next (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2193:14)
    at cachedWrite (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2053:9)
    at renderStringNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:7095:5)
    at RenderContext.renderNode (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:6901:5)
    at RenderContext.next (/home/nginx/domains/stnetwork.fr/public/nuxtjs/node_modules/vue-server-renderer/build.js:2193:14)

my nuxtent.config.js :

module.exports = {
  content: [
    [
      'posts',
      {
        page: '/posts/_slug',
        permalink: '/:year/:slug',
        generate: ['get', 'getAll']
      }
    ],
    [
      'projects',
      {
        page: '/projects/_slug',
        permalink: '/projects/:slug',
        isPost: false,
        generate: ['get', 'getAll']
      }
    ]
  ],

api: {
  baseURL: process.env.NODE_ENV === 'production'
    ? 'http://stnetwork.surge.sh'
    : 'http://localhost:3000'
}
}

my package.json

{
  "name": "example",
  "version": "1.0.0",
  "description": "nuxtent multiple content types example",
  "author": "Alid Castano <alidcastano@gmail.com>",
  "dependencies": {
    "@nuxtjs/axios": "^4.3.0",
    "nuxt": "latest",
    "nuxtent": "latest"
  },
  "scripts": {
    "dev": "HOST=0.0.0.0 PORT=3000 nuxt",
    "build": "nuxt build",
    "start": "HOST=0.0.0.0 PORT=3000 nuxt start",
    "generate": "NODE_ENV='production' nuxt generate",
    "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
    "precommit": "npm run lint"
  },
  "devDependencies": {
    "@nuxtjs/cssnano": "^1.0.1",
    "@nuxtjs/optimize": "^1.1.1",
    "@nuxtjs/pwa": "^0.2.1",
    "babel-eslint": "^8.0.1",
    "buefy": "^0.5.2",
    "bulmaswatch": "^0.5.0",
    "eslint": "^4.7.2",
    "eslint-config-standard": "^10.2.1",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-html": "^3.2.2",
    "eslint-plugin-promise": "^3.5.0",
    "eslint-plugin-standard": "^3.0.1",
    "highlight.js": "^9.12.0",
    "node-sass": "^4.5.3",
    "sass-loader": "^6.0.6"
  }
}
This question is available on Nuxt.js community (#c79)
medfreeman commented 7 years ago

Sorry about this, meant to push to a feature branch first. The issue is resolved, but involves to do things differently, for the better. We should not rely on environment variables at all in our nuxtent config.

medfreeman commented 7 years ago

This time i'll add additional tests and refactoring before making a release.

STnetwork commented 7 years ago

@medfreeman

You think you will soon release the correction of this issue ?

medfreeman commented 7 years ago

@stnetwork

Oh, sure, i'll just discuss with @alidcastano about the api change, and release it today if ok.

STnetwork commented 7 years ago

@medfreeman good news !

alidcast commented 7 years ago

Sorry for the delay @STnetwork. I just spoke with @medfreeman and he will be releasing changes tonight

medfreeman commented 7 years ago

@STnetwork the fix has just been released in v1.1.0 Please take a look at the changelog to understand the new way to achieve this. The docs will soon be updated with the relevant information.