TypeError: Cannot read property 'kind' of undefined

问题描述 投票:0回答:1

我正在尝试使用本地数据库将我的 v3 strapi 应用程序迁移到本地计算机上的 v4。我正在尝试执行代码迁移。最初我已经按照 strapi v4 的文档更改了配置文件。我使用 codemods 更改文件夹结构并更新路由、控制器和服务。

现在,当我尝试运行我的 strapi 应用程序时,出现此错误并且应用程序构建中断。

这些是我的路由、控制器、服务和 schema.json 文件

路线:

'use strict';

/**
 * blog router
 */

const { createCoreRouter } = require('@strapi/strapi').factories;

module.exports = createCoreRouter('api::blog.blog');


Controller:

'use strict';

/**
 * blog controller
 */

const { createCoreController } = require('@strapi/strapi').factories;

module.exports = createCoreController('api::blog.blog');


service:

'use strict';

/**
 * blog service
 */

const { createCoreService } = require('@strapi/strapi').factories;

module.exports = createCoreService('api::blog.blog');


schema.json:

{
  "kind": "collectionType",
  "collectionName": "blogs",
  "info": {
    "singularName": "blog",
    "pluralName": "blogs",
    "displayName": "Blog",
    "name": "blog"
  },
  "options": {
    "increments": true,
    "timestamps": true,
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    "insightImage": {
      "type": "media",
      "allowedTypes": [
        "images",
        "files",
        "videos"
      ],
      "multiple": false,
      "required": false
    },
    "insightTitle": {
      "type": "string"
    },
    "insightDescription": {
      "type": "text"
    },
    "insightContent": {
      "type": "richtext"
    },
    "slug": {
      "type": "string",
      "unique": true
    },
    "categories": {
      "type": "relation",
      "relation": "manyToMany",
      "target": "api::category.category",
      "mappedBy": "blogs"
    },
    "insightDate": {
      "type": "date"
    },
    "views": {
      "type": "integer",
      "default": 0
    },
    "featured": {
      "type": "boolean"
    },
    "frontImage": {
      "type": "boolean"
    },
    "insightsMetaData": {
      "type": "component",
      "repeatable": false,
      "component": "meta.metadata"
    },
    "industry": {
      "type": "relation",
      "relation": "manyToOne",
      "target": "api::industry.industry",
      "inversedBy": "blogs"
    },
    "solution": {
      "type": "relation",
      "relation": "manyToOne",
      "target": "api::solution.solution",
      "inversedBy": "blogs"
    },
    "type": {
      "type": "relation",
      "relation": "manyToOne",
      "target": "api::type.type",
      "inversedBy": "blogs"
    },
    "featured_topics": {
      "type": "relation",
      "relation": "manyToMany",
      "target": "api::featured-topic.featured-topic",
      "inversedBy": "blogs"
    },
    "formTitle": {
      "type": "string"
    },
    "formId": {
      "type": "string"
    },
    "author": {
      "type": "relation",
      "relation": "manyToOne",
      "target": "api::author.author",
      "inversedBy": "blogs"
    },
    "enableGated": {
      "type": "boolean"
    },
    "insightBannerImage": {
      "type": "media",
      "allowedTypes": [
        "images",
        "files",
        "videos"
      ],
      "multiple": false,
      "required": false
    },
    "breakTitleText": {
      "type": "boolean",
      "default": false
    }
  }
}

next.js strapi
1个回答
0
投票

查看您创建的所有收藏并删除一次没有

content-types
文件夹或
schema.js
。您可以稍后重新创建它们。

那是我的问题。

© www.soinside.com 2019 - 2024. All rights reserved.