Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

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

Closed
STnetwork opened this issue Sep 29, 2017 · 7 comments
Assignees

Comments

@STnetwork
Copy link

STnetwork commented Sep 29, 2017

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 <[email protected]>",
  "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)
@STnetwork STnetwork changed the title TypeError: Cannot read property 'name' of undefined TypeError: Cannot read property 'name' of undefined - multiple content example Sep 29, 2017
@medfreeman medfreeman reopened this Sep 29, 2017
@medfreeman
Copy link
Contributor

medfreeman commented Sep 29, 2017

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
Copy link
Contributor

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

@STnetwork
Copy link
Author

@medfreeman

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

@medfreeman
Copy link
Contributor

@STnetwork

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

@STnetwork
Copy link
Author

@medfreeman good news !

@alidcast
Copy link
Contributor

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

@medfreeman
Copy link
Contributor

medfreeman commented Oct 22, 2017

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants