How to deploy a nuxt app to GitHub Pages
In this tutorial, we are going to learn about how to host your nuxt app to GitHub pages by using the command line.
Deploying to GitHub Pages
- First, create a new repository in GitHub and push your nuxt app to it.

- Now, open your
nuxt.config.jsfile and add the following configuration to theexport defaultobject.
nuxt.config.js
export default {
mode: 'static',
router: {
base: '/your-github-repository-name/'
},
// other config goes here
}- Install the
gh-pagespackage by using the below command.
npm install gh-pages --save-dev- Add the following deploy commands to your
package.jsonfilescriptsobject.
"predeploy": "nuxt generate",
"deploy": "gh-pages -d dist"- Run the following command to successfully deploy your app to GitHub pages.
npm run deployNow, open your nuxt app GitHub repository and click on the settings tab, if your scroll down to the GitHub Pages section you will see a nuxt app live URL like this.



