问题
Struggling with this one. I've downloaded and installed locally, this Gatsby starter pack:
https://github.com/ChangoMan/gatsby-starter-dimension .
And i'm trying to deploy to my github web page: https://reenaverma.github.io/
I've followed the instructions, but keep getting this error when I run npm run deploy:
> gatsby-starter-dimension@1.0.0 deploy /Users/reenaverma/development/gatsby-starter-dimension
> gatsby build && gh-pages -b master -d public
success delete html and css files from previous builds — 0.014 s
success open and validate gatsby-config — 0.004 s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's not any stale
data
success copy gatsby files — 0.014 s
success onPreBootstrap — 0.858 s
success source and transform nodes — 0.111 s
success building schema — 0.239 s
success createLayouts — 0.006 s
success createPages — 0.019 s
success createPagesStatefully — 0.005 s
success onPreExtractQueries — 0.004 s
success update schema — 0.102 s
success extract queries from components — 0.070 s
success run graphql queries — 0.098 s
success write out page data — 0.004 s
success write out redirect data — 0.001 s
success onPostBootstrap — 0.001 s
info bootstrap finished - 4.183 s
success Building CSS — 2.647 s
success Building production JavaScript bundles — 4.936 s
success Building static HTML for pages — 1.787 s
info Done building in 13.557 sec
sh: gh-pages: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! gatsby-starter-dimension@1.0.0 deploy: `gatsby build && gh-pages -b master -d public`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the gatsby-starter-dimension@1.0.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/reenaverma/.npm/_logs/2018-05-30T17_41_52_319Z-debug.log
Here's my package.json:
{
"name": "gatsby-starter-dimension",
"description": "Gatsby Starter - Dimension by HTML5 UP",
"version": "1.0.0",
"author": "Hunter Chang",
"dependencies": {
"gatsby": "^1.9.235",
"gatsby-link": "^1.6.39",
"gatsby-image": "^1.0.42",
"gatsby-plugin-google-analytics": "^1.0.24",
"gatsby-plugin-react-helmet": "^1.0.8",
"gatsby-plugin-sass": "^1.0.23",
"gatsby-plugin-sharp": "^1.6.41",
"gatsby-remark-copy-linked-files": "^1.5.30",
"gatsby-remark-images": "^1.5.56",
"gatsby-source-filesystem": "^1.5.27",
"gatsby-transformer-remark": "^1.7.37",
"gatsby-transformer-sharp": "^1.6.22",
"lodash": "^4.17.4"
},
"homepage": "https://github.com/ChangoMan/gatsby-starter-dimension",
"keywords": [
"gatsby"
],
"license": "MIT",
"main": "n/a",
"repository": {
"type": "git",
"url": "https://github.com/ChangoMan/gatsby-starter-dimension.git"
},
"scripts": {
"dev": "gatsby develop",
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .",
"test": "echo \"Error: no test specified\" && exit 1",
"develop": "gatsby develop",
"build": "gatsby build",
"deploy": "gatsby build && gh-pages -b master -d public",
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix gatsby-node.js"
},
"devDependencies": {
"gh-pages": "^1.1.0",
"prettier": "^1.12.0"
}
}
And gatsby-config.sj:
module.exports = {
siteMetadata: {
title: "Gatsby Starter - Dimension by HTML5 UP",
author: "Hunter Chang",
description: "A Gatsby.js Starter based on Dimension by HTML5 UP"
},
pathPrefix: '/',
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/posts`,
name: "posts",
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 630,
},
},
"gatsby-remark-copy-linked-files",
],
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sass`
],
}
回答1:
got it working! I didnt install this:
npm install gh-pages --save-dev
来源:https://stackoverflow.com/questions/50610679/gatsby-deployment-to-github-failing