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

nuxt generate only causes 404 #89

Closed
alidcast opened this issue Sep 27, 2017 · 2 comments
Closed

nuxt generate only causes 404 #89

alidcast opened this issue Sep 27, 2017 · 2 comments
Assignees

Comments

@alidcast
Copy link
Contributor

alidcast commented Sep 27, 2017

@medfreeman I'm still getting 404 when I run nuxt generate (instead of nuxtent generate with previous binaries)

JSON files are generated but it seems like pages are not compiled appropriately. For example with multiple content type example I get:

==== Error report ==== 
Route: '/nuxtent' thrown an error: 
{"statusCode":404,"message":"This page could not be found"}

Route: '/ency' thrown an error: 
{"statusCode":404,"message":"This page could not be found"}

If I serve the site, the client navigation works fine but refreshing page displays not found error.

Also related to #88, if we stick to not having binaries we have to let users specify static=true some other way, e.g. via config, so that browser URL can be set appropriately and static files can be generated.

This question is available on Nuxt.js community (#c76)
@alidcast
Copy link
Contributor Author

alidcast commented Sep 27, 2017

Your solution (https://github.com/nuxt-community/nuxtent-module/blob/master/lib/module.js#L131) looks equivalent to using binaries, as the only special thing I was doing was starting the Nuxt server so that server middleware could be active when pages were being generated. But for some reason, the server is still not running.

@alidcast alidcast assigned alidcast and medfreeman and unassigned alidcast Sep 27, 2017
@STnetwork
Copy link

STnetwork commented Sep 27, 2017

@alidcastano

If it can help you I have a small different error when a set an apiBaseUrl

image

my

nuxtent.config.js

module.exports = {
  content: [
    [
      'posts',
      {
        page: '/_post',
        permalink: ':year/:slug',
        generate: ['get', 'getAll']
      }
    ],
    [
      'projects',
      {
        page: '/projects/slug',
        permalink: '/: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": "STATIC=true 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"
  }
}

medfreeman added a commit that referenced this issue Sep 29, 2017
medfreeman added a commit that referenced this issue Sep 29, 2017
Properly set `axios` baseUrl accordingly
Properly trigger static routes generation in content builder accordingly

fixes #83, #88, #89
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