我正在使用Gatsby和reactjs创建我的投资组合。我在localhost上运行带有gatsby develop
的静态服务器。我安装了gatsby-favicon-plugin来添加favicon到我的网站,我正确配置它并没有得到任何结果(favicon还没有显示)。目前,静态服务器运行时没有任何错误,然后我停止了它并重新启动。现在,当我运行gatsby develop
启动服务器时,我遇到了错误。
这是我遇到的错误。
success delete html and css files from previous builds — 0.009 s
success open and validate gatsby-config.js — 0.006 s
error UNHANDLED REJECTION
SyntaxError: 'return' outside of function (28:0)
- index.js:4454 Parser.pp$5.raise
[personal]/[babylon]/lib/index.js:4454:13
- index.js:2066 Parser.pp$1.parseReturnStatement
[personal]/[babylon]/lib/index.js:2066:10
- index.js:1848 Parser.pp$1.parseStatement
[personal]/[babylon]/lib/index.js:1848:19
- index.js:5910 Parser.parseStatement
[personal]/[babylon]/lib/index.js:5910:22
- index.js:2268 Parser.pp$1.parseBlockBody
[personal]/[babylon]/lib/index.js:2268:21
- index.js:1778 Parser.pp$1.parseTopLevel
[personal]/[babylon]/lib/index.js:1778:8
- index.js:1673 Parser.parse
[personal]/[babylon]/lib/index.js:1673:17
- index.js:7305 Object.parse
[personal]/[babylon]/lib/index.js:7305:37
- resolve-module-exports.js:36 module.exports
[personal]/[gatsby]/dist/bootstrap/resolve-module-exports.js:36:21
- validate.js:101
[personal]/[gatsby]/dist/bootstrap/load-plugins/validate.js:101:29
- Array.forEach
- validate.js:93 collatePluginAPIs
[personal]/[gatsby]/dist/bootstrap/load-plugins/validate.js:93:20
- index.js:73 _callee$
[personal]/[gatsby]/dist/bootstrap/load-plugins/index.js:73:15
- next_tick.js:131 _combinedTickCallback
internal/process/next_tick.js:131:7
这是我的gatsby-config.js
。
module.exports = {
siteMetadata: {
title: `Pankaja's Portfolio`,
},
plugins: [
'gatsby-plugin-react-helmet',
`gatsby-plugin-styled-components`,
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: "xxxxxxxx",
// Puts tracking script in the head instead of the body
head: false,
// Setting this parameter is optional
anonymize: true,
// Setting this parameter is also optional
respectDNT: true,
},
},
{
resolve: `gatsby-plugin-favicon`,
options: {
logo: './src/assets/me.png',
injectHTML: true,
icons: {
android: true,
appleIcon: true,
appleStartup: true,
coast: false,
favicons: true,
firefox: true,
twitter: false,
yandex: false,
windows: false
}
}
},
],
}
我无法弄清楚这有什么问题(按照我的说法)。任何帮助将不胜感激。