Nuxt.js: Generate is not work correctly

Created on 11 Oct 2017  路  17Comments  路  Source: nuxt/nuxt.js

After running nuxt generate operation, the page of index.html can load correctly. But its JS dependencies aren't working unless the components locate in the layouts folder. Finally, if the version is oldest, it will work normally.

This question is available on Nuxt.js community (#c1638)

Most helpful comment

@gvinter @KermitLi

I didn't need to use nginx. I fixed it!

Check out: https://nuxtjs.org/api/configuration-router/

I just had to add

  router: {
    base: '/my-github-repository-name/'
  }

and it deployed properly

All 17 comments

@KermitLi - What do you mean by "version is oldest"?

Another issue related to this is image assets:
https://github.com/nuxt/nuxt.js/issues/1676

@gvinter

The meaning is if I use the older version of nuxt, it will work correctly.

My images assets can work correctly.The current problem is after running nuxt generate operation, I deploy the files of dist folder to my static server. The page can load normally, but its js files can't work and no error is thrown.

@KermitLi - which older version of nuxt works for you on this?

I'm getting this issue too trying to deploy to GitHub Pages. Just the index.html loads, no javascript whatsoever.

"generate": "nuxt generate",
"deploy": "push-dir --dir=dist --branch=gh-pages --cleanup"
...
"nuxt": "^1.0.0-rc11",

I haven't configured generate in any way. Just ran yarn run generate and yarn run deploy according to the documentation.

Unless I am doing this wrong? @gvinter

Getting these errors in GitHub pages:

image

@SyedAman - I just figured it out! Generating to /dist doesn't just generate static files that can be opened as HTML files in a browser. You must point a local server (ie. nginx) at the /dist directory and access via the server, such as localhost:8000.

So if you haven't already, install nginx, then point you nginx.conf's file's root location at the /dist folder you want to serve...

server {
    location / {
            root   /Users/gvinter/NUXT_PROJECT/dist;
            index  index.html index.htm;
    }
}

And that works for me!

@gvinter can GitHub pages run nginx?

@gvinter @KermitLi

I didn't need to use nginx. I fixed it!

Check out: https://nuxtjs.org/api/configuration-router/

I just had to add

  router: {
    base: '/my-github-repository-name/'
  }

and it deployed properly

@gvinter

I forget it's which version of nuxt because of using it before a long time.
Now, I try using v 0.10.7, 0.10.6, v0.10.5, v0.10.4 and v0.10.1 etc.But the whole of thme can't work correctly.

@KermitLi you should be fine with the fixes mentioned above.

I'm still trying to figure out why navigating to index.html doesn't work. Try going to http://bikeva.com/index.html then http://bikeva.com they both have the same script tags but in the index.html link none of them fire. Repository is https://github.com/coletrane/mountain-bike-virginia if that helps. As an alternative I'm seeing if S3 can just redirect all requests to index.html to /

@Coletrane I have the same problem.

I think it just doesn't understand where you are, and so doesn't run the correct component. The scripts do get downloaded.

Weird how that causes exactly 0 errors to be logged.

@Coletrane I have the same problem.

Add the router works, but now i'm having a annoying issue. Every route now is duplicated. (https://vss-sdk.github.io/vss-sdk.github.io/doc-overview-dev).

Here is the repository: https://github.com/VSS-SDK/vss-sdk.github.io

router: {
   base: '/my-github-repository-name/'
}

@Coletrane @qm3ster @GoBrianGo Did any of you find a solution to the index.html issue?

any solution on this? I'm having the same problem.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lazycrazy picture lazycrazy  路  3Comments

vadimsg picture vadimsg  路  3Comments

vadimsg picture vadimsg  路  3Comments

danieloprado picture danieloprado  路  3Comments

bimohxh picture bimohxh  路  3Comments