[英]Gatsby - “value” must contain at least one of [icon, icons]
當我在控制台中運行 gatsby develop 時,會出現此錯誤:
ERROR #11331 PLUGIN Invalid plugin options for "gatsby-plugin-manifest": - "value" must contain at least one of [icon, icons]
我剛剛在此處克隆了一個啟動器 github 分支並安裝了所有節點模塊。 請記住,我是新來的反應/蓋茨比。 我在 web 上搜索了這個錯誤,但沒有找到任何有用的信息。
這是我的 gatsby-config.js:
module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-feed`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Gatsby Starter Blog`,
short_name: `GatsbyJS`,
start_url: `/`,
background_color: `#ffffff`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `${__dirname}/src/assets`,
},
},
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `assets`,
path: `${__dirname}/src/assets`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
},
},
`gatsby-plugin-styled-components`,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
}
這是我的 package.json:
{
"name": "gatsby-starter-default",
"private": true,
"description": "A simple starter to get up and developing quickly with Gatsby",
"version": "0.1.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"babel-plugin-styled-components": "^1.10.7",
"framer-motion": "^1.10.2",
"gatsby": "^2.19.45",
"gatsby-image": "^2.2.44",
"gatsby-plugin-feed": "^2.11.0",
"gatsby-plugin-manifest": "^2.10.0",
"gatsby-plugin-offline": "^3.0.41",
"gatsby-plugin-react-helmet": "^3.1.24",
"gatsby-plugin-sharp": "^2.4.13",
"gatsby-plugin-styled-components": "^3.2.1",
"gatsby-source-filesystem": "^2.1.56",
"gatsby-transformer-sharp": "^2.3.19",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-canvas": "^1.3.0",
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1",
"react-intersection-observer": "^8.26.1",
"styled-components": "^5.0.1",
"styled-normalize": "^8.0.7"
},
"devDependencies": {
"prettier": "^1.19.1"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
任何幫助都會得到幫助::)
您的gatsby-config.js
中有兩個gatsby-plufin manifest
實例。 刪除其中之一:
module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-feed`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `assets`,
path: `${__dirname}/src/assets`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
},
},
`gatsby-plugin-styled-components`,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
}
如果您不想使用圖標,因為它不是強制性屬性,您可以將其刪除。 但是,如果您正在使用它,則必須提供有效的圖標,而不是文件夾:
icon: `${__dirname}/src/assets/iconName.png`,
icon: `${__dirname}/src/assets`,
上面的行必須指向一個文件,而不是一個文件夾
https://www.gatsbyjs.com/plugins/gatsby-plugin-manifest/#hybrid-mode-configuration
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `GatsbyJS`,
short_name: `GatsbyJS`,
start_url: `/`,
background_color: `#f7f0eb`,
theme_color: `#a2466c`,
display: `standalone`,
icon: `src/images/icon.png`, // This path is relative to the root of the site.
icons: [
{
src: `/favicons/android-chrome-192x192.png`,
sizes: `192x192`,
type: `image/png`,
},
{
src: `/favicons/android-chrome-512x512.png`,
sizes: `512x512`,
type: `image/png`,
},
], // Add or remove icon sizes as desired
},
},
],
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.