Gatsby部署到Github失败 [英] Gatsby Deployment to Github Failing

查看:83
本文介绍了Gatsby部署到Github失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为此奋斗。我已经在本地下载并安装了该盖茨比入门包:

Struggling with this one. I've downloaded and installed locally, this Gatsby starter pack:

https://github.com/ChangoMan/gatsby-starter-dimension

我正尝试部署到我的github网页:
https://reenaverma.github.io/

And i'm trying to deploy to my github web page: https://reenaverma.github.io/

我已经按照说明进行操作,但是在运行npm时仍然会出现此错误运行部署:

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

这是我的package.json:

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"
  }
}

和gatsby-config.sj:

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`
  ],
}


推荐答案

让它正常工作!我没有安装它:

got it working! I didnt install this:

npm install gh-pages --save-dev  

这篇关于Gatsby部署到Github失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆