Perdixo
Perdixo

Reputation: 1299

Nuxt generate returns 404 errors

I've read multiple articles and posts about the nuxt generate issues, but i couldn't find an answer. So I'm learning Vue & Nuxt. I've create a spa, and i'm trying to host it on my website (in a subfolder eg. http://mywebsite.com/subfolder/). It's a simple hosting website (shared server) so i'd like to generate a static website from my files.

I'm running nuxt generate , but when i move the dist folder generated in my subfolder, i'm getting erros :

GET http://mywebsite.com/_nuxt/5f51d97c56209053356b.js net::ERR_ABORTED 404 (Not Found)

Of course, the path should be

http://mywebsite.com/subfolder/_nuxt/5f51d97c56209053356b.js

How can i fix this? From what i've understand, i should add some lines in my nuxt.config.js file right? I've tried multiple combinations, but i can't make it work..

Upvotes: 5

Views: 5264

Answers (1)

Perdixo
Perdixo

Reputation: 1299

Allright so this was simple, i've finally found the answer in the docs. I've simply added in my nuxt.config.js file the following :

router: {
    base: '/subfolder/'
  }

Upvotes: 6

Related Questions