【发布时间】:2021-04-08 21:29:12
【问题描述】:
我正在尝试使用博客部署我的第一个 gatsby 站点,但它一直失败。我已经更新了所有依赖项,但现在我无法弄清楚到底是什么问题。
我真的很感激任何建议,它已经困扰了我好几天了。在此之前,我遇到了一堆 npm 错误,因此我更新了所有我认为可以解决问题的依赖项。
仅供参考,我在博客中使用内容丰富的 cms
这里的构建似乎失败了:
12:33:55 PM: error A page component must export a React component for it to be valid. Please make sure this file exports a React component:
12:33:55 PM: /opt/build/repo/src/pages/BlogElements.js
12:33:55 PM: not finished createPagesStatefully - 0.064s
12:33:55 PM: npm ERR! code ELIFECYCLE
12:33:55 PM: npm ERR! errno 1
12:33:55 PM: npm ERR! gatsby-starter-hello-world@0.1.0 build: `gatsby build`
12:33:55 PM: npm ERR! Exit status 1
12:33:55 PM: npm ERR!
12:33:55 PM: npm ERR! Failed at the gatsby-starter-hello-world@0.1.0 build script.
12:33:55 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
12:33:55 PM: npm ERR! A complete log of this run can be found in:
12:33:55 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-01-02T12_33_55_072Z-debug.log
BlogElements.js 文件只是一个样式化组件:
import styled from 'styled-components';
export const Styledh2 = styled.h2`
color: purple;
`;
export const StyledBox = styled.li`
width: 500px;
background-color: lightblue;
float: left
`
export const StyledLink = styled.div`
background-color: yellow;
position: relative;
left: 3rem;
justify-content: space-around
`
【问题讨论】:
标签: deployment build graphql gatsby netlify