"Backend not found" 使用 netlifyCMS 和 Gatsby
"Backend not found" with netlifyCMS and Gatsby
我一直在尝试在通过克隆 gatsby-starter-default. I followed the Sourcing from Netlify CMS instructions 制作的真正基本的 Gatsby 应用程序上设置 NetlifyCMS,但我一直收到“未找到后端”错误。这是我的 Gatsby 设置:
/static/admin/config.yml
backend:
name: appendtoStatic
branch: master
media_folder: static/img
public_folder: /images
collections:
- name: "pages"
label: "Pages"
files:
- file: "src/pages/about.md"
label: "About"
name: "about"
fields:
- {
label: "Template Key",
name: "templateKey",
widget: "hidden",
default: "about-page",
}
- { label: "Title", name: "title", widget: "string" }
- { label: "Body", name: "body", widget: "markdown" }
这是我的 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": {
"gatsby": "^2.2.3",
"gatsby-image": "^2.0.34",
"gatsby-plugin-manifest": "^2.0.24",
"gatsby-plugin-netlify-cms": "^3.0.17",
"gatsby-plugin-offline": "^2.0.25",
"gatsby-plugin-react-helmet": "^3.0.10",
"gatsby-plugin-sharp": "^2.0.30",
"gatsby-source-filesystem": "^2.0.27",
"gatsby-transformer-remark": "^2.3.8",
"gatsby-transformer-sharp": "^2.1.17",
"netlify-cms": "^2.9.0",
"prop-types": "^15.7.2",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-helmet": "^5.2.0"
},
"devDependencies": {
"prettier": "^1.16.4"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write src/**/*.{js,jsx}",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\""
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
我的盖茨比-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-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `src`,
path: `${__dirname}/src/`,
},
},
`gatsby-transformer-sharp`,
`gatsby-transformer-remark`,
`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`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
`gatsby-plugin-netlify-cms`,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// 'gatsby-plugin-offline',
],
}
我这辈子都想不通为什么这行不通。
我尝试了 Sourcing from NetlifyCMS 文档中的确切教程并开始使用。我不确定 why/where/how 我尝试将 netlifyCMS 添加到默认的 Gatsby 启动器失败了...
在您的 config.yml 中,后端名称应该是 git 服务,例如 github、gitlab 或 bitbucket,您的 repo 名称列在 repo 字段中。
示例来自 docs:
backend:
name: github
repo: owner-name/repo-name
我一直在尝试在通过克隆 gatsby-starter-default. I followed the Sourcing from Netlify CMS instructions 制作的真正基本的 Gatsby 应用程序上设置 NetlifyCMS,但我一直收到“未找到后端”错误。这是我的 Gatsby 设置:
/static/admin/config.yml
backend:
name: appendtoStatic
branch: master
media_folder: static/img
public_folder: /images
collections:
- name: "pages"
label: "Pages"
files:
- file: "src/pages/about.md"
label: "About"
name: "about"
fields:
- {
label: "Template Key",
name: "templateKey",
widget: "hidden",
default: "about-page",
}
- { label: "Title", name: "title", widget: "string" }
- { label: "Body", name: "body", widget: "markdown" }
这是我的 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": {
"gatsby": "^2.2.3",
"gatsby-image": "^2.0.34",
"gatsby-plugin-manifest": "^2.0.24",
"gatsby-plugin-netlify-cms": "^3.0.17",
"gatsby-plugin-offline": "^2.0.25",
"gatsby-plugin-react-helmet": "^3.0.10",
"gatsby-plugin-sharp": "^2.0.30",
"gatsby-source-filesystem": "^2.0.27",
"gatsby-transformer-remark": "^2.3.8",
"gatsby-transformer-sharp": "^2.1.17",
"netlify-cms": "^2.9.0",
"prop-types": "^15.7.2",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-helmet": "^5.2.0"
},
"devDependencies": {
"prettier": "^1.16.4"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write src/**/*.{js,jsx}",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\""
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
我的盖茨比-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-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `src`,
path: `${__dirname}/src/`,
},
},
`gatsby-transformer-sharp`,
`gatsby-transformer-remark`,
`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`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
`gatsby-plugin-netlify-cms`,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// 'gatsby-plugin-offline',
],
}
我这辈子都想不通为什么这行不通。
我尝试了 Sourcing from NetlifyCMS 文档中的确切教程并开始使用。我不确定 why/where/how 我尝试将 netlifyCMS 添加到默认的 Gatsby 启动器失败了...
在您的 config.yml 中,后端名称应该是 git 服务,例如 github、gitlab 或 bitbucket,您的 repo 名称列在 repo 字段中。
示例来自 docs:
backend:
name: github
repo: owner-name/repo-name