Skip to content

Instantly share code, notes, and snippets.

@fahmiegerton
Created May 29, 2020 15:39
Show Gist options
  • Save fahmiegerton/97162e76848b1c2b7c2381fef358d331 to your computer and use it in GitHub Desktop.
Save fahmiegerton/97162e76848b1c2b7c2381fef358d331 to your computer and use it in GitHub Desktop.
Cara deploy Nuxtjs App (Universal Mode) ke GitHub Pages
//install push-dir
yarn add gh-pages cross-env --save-dev
//buka file .env dan tambahkan ini
DEPLOY_ENV=GH_PAGES
//tambahkan command di package.json
"build:gh-pages": "cross-env DEPLOY_ENV=GH_PAGES nuxt build",
"generate:gh-pages": "cross-env DEPLOY_ENV=GH_PAGES nuxt generate",
"deploy": "gh-pages -d dist"
//tambahkan ini ke nuxt.config.js
const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? {
router: {
base: '/<nama-repo>/'
}
} : {}
export default {
...routerBase
}
//kemudian build static site nya
yarn generate:gh-pages
yarn deploy
// kalo ada error kaya
fatal: HttpRequestException encountered.
An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No such file or directory
// ketik ini di console
git config --global credential.helper wincred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment