我正在尝试在Github页面上部署我的Gatsby Blog,但是“ npm run deploy”返回错误

时间:2018-09-20 09:44:45

标签: reactjs github npm github-pages gatsby

我试图在github页面上构建并部署我的Gatsby博客。 我关注了盖茨比(Gatsby)关于部署的文档:https://www.gatsbyjs.org/docs/deploy-gatsby/

我运行以下命令:

npm run deploy

我遇到了:

Cannot read property 'email' of null
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-hello-world@ deploy: `gatsby build && gh-pages -b master -d public`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gatsby-starter-hello-world@ 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/ChaewonKong/.npm/_logs/2018-09-20T09_34_57_114Z-debug.log

这是我的gatsby-config.js样子:

module.exports = {
  siteMetadata: {
    title: `Leon Kong's Blog`
  },
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `src`,
        path: `${__dirname}/src/`
      }
    },
    `gatsby-transformer-remark`
  ]
};

这是我的package.json:

{
  "name": "gatsby-starter-hello-world",
  "description": "Gatsby hello world starter",
  "license": "MIT",
  "scripts": {
    "develop": "gatsby develop",
    "build": "gatsby build",
    "serve": "gatsby serve",
    "deploy": "gatsby build && gh-pages -b master -d public"
  },
  "dependencies": {
    "gatsby": "^2.0.0",
    "gatsby-source-filesystem": "^2.0.1",
    "gatsby-transformer-remark": "^2.1.3",
    "react": "^16.5.1",
    "react-dom": "^16.5.1"
  },
   "devDependencies": {
    "gh-pages": "^2.0.0"
  }
}

此外,我正在尝试创建一个用户/组织网站,例如: https://username/github.io

1 个答案:

答案 0 :(得分:0)

我只是猜测您的git配置中没有设置电子邮件。尝试运行git config user.email来查看它是否存在。

您可以按照本文介绍如何添加https://help.github.com/articles/setting-your-commit-email-address-in-git/

另外,这里是docs on how to set a github page