【问题标题】:Gatsby CMS - Failed to load settings from /.netlify/identityGatsby CMS - 无法从 /.netlify/identity 加载设置
【发布时间】:2019-02-23 21:15:55
【问题描述】:

我在 ubuntu 16.04 机器上安装了 gastby 2

gatsby new netlifycms2 https://github.com/netlify-templates/gatsby-starter-netlify-cms 

没有错误。

但是,当我访问 /admin 并单击 使用 netlify 登录时,我收到了消息

无法从 /.netlify/identity 加载设置

我假设我需要这个文件,但没有找到任何关于如何安装它的说明。

我在 static/admin/.netlify/identity 中手动添加了一个空白身份文件,然后运行 ​​gatsby build 和 gatsby serve 但错误消息仍然存在

我已经阅读了authentication and backends 这个blog 这表明:

“启用身份服务后,GoTrue 微服务的托管版本可让您在 /.netlify/identity 下为任何 Netlify 站点添加用户注册和管理。”

我注意到 gotrue cms.js 安装在 admin 目录和其他一些目录中

./public/admin/cms.js
./node_modules/netlify-cms/dist/cms.js
./node_modules/gatsby-plugin-netlify-cms/cms.js
./src/cms/cms.js

netlify 身份插件是否存在未创建此文件的错误?

 System:
    OS: Linux 4.4 Ubuntu 16.04.5 LTS (Xenial Xerus)
    CPU: x64 Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
    Shell: 4.3.48 - /bin/bash
  Binaries:
    Node: 10.10.0 - /usr/bin/node
    Yarn: 1.9.4 - /usr/bin/yarn
    npm: 6.4.1 - /usr/bin/npm
  npmPackages:
    gatsby: ^2.0.0 => 2.0.1 
    gatsby-plugin-netlify: ^2.0.0 => 2.0.0 
    gatsby-plugin-netlify-cms: ^3.0.0 => 3.0.1 
    gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0 
    gatsby-plugin-sass: ^2.0.1 => 2.0.1 
    gatsby-plugin-sharp: ^2.0.5 => 2.0.5 
    gatsby-remark-images: ^2.0.1 => 2.0.1 
    gatsby-source-filesystem: ^2.0.1 => 2.0.1 
    gatsby-transformer-remark: ^2.1.1 => 2.1.2 
    gatsby-transformer-sharp: ^2.1.1 => 2.1.1 
  npmGlobalPackages:
    gatsby-cli: 2.4.1

此外,我已经将https://github.com/netlify-templates/gatsby-starter-netlify-cms 克隆到 gitlab 中,但是我遇到了同样的问题。

【问题讨论】:

    标签: gatsby netlify netlify-cms


    【解决方案1】:

    Gatsby starter 使用 git-gateway 后端为 netlify-cms 并希望托管在 Netlify 上并启用 Netlify 身份服务。 Gatsby Starter 项目是一键式模板之一。

    backend:
      name: git-gateway
      branch: master
    

    Netlify 使用GoTrue 用 golang 编写的开源 API,可以作为一个独立的 API 服务来处理用户注册和身份验证。

    GoTrue 不属于 NetlifyCMS 应用程序包(netlify-cms.js 或 cms.js)。当您在 Netlify 站点上启用身份时,会在该站点上为 /.netlify/identity 创建一个 API 端点 端点。添加没有 GoTrue API 的端点是无效的。

    Git 网关选项

    在 Netlify 上托管 Gatsby/NetlifyCMS 站点并通过站点管理员在 app.netlify.com 上启用 Netlify Identity service 并继续使用 git-gateway

    使用 GitLab 自行托管

    自行托管您的网站并将 config.yml 更改为使用 GitLab 后端并使用 implicit grant setup

    使用您自己的 OAuth

    自行托管您的网站并更改 config.yml 以使用 GitHub 后端和 use your own OAuth authentication

    【讨论】:

      猜你喜欢
      • 2021-08-29
      • 1970-01-01
      • 2021-07-01
      • 1970-01-01
      • 2019-04-18
      • 2020-01-19
      • 2018-09-26
      • 1970-01-01
      • 2019-05-12
      相关资源
      最近更新 更多