使用默认命令搭建MedusaJS+Strapi时遇ApplicationError求助
解决Strapi-Medusa集成启动时的
ApplicationError: The type is required错误 问题原因
你使用的shahednasser/strapi-medusa-template模板中,某个自定义内容类型的字段定义缺失了必填的type属性,导致Strapi的Content Manager插件在生成默认布局配置时触发错误。
修复步骤
检查内容类型Schema文件
进入项目的src/api目录,逐个查看所有内容类型的schema.json文件(路径示例:src/api/product/content-types/product/schema.json),定位attributes下缺少type属性的字段。补全缺失的
type属性
针对缺失type的字段补充合法的Strapi字段类型(如string、number、relation等),比如模板中常见的medusaId字段:"attributes": { "medusaId": { "type": "string" }, // 其他字段配置... }清理缓存并重启项目
删除项目根目录下的.strapi缓存文件夹,再重新启动项目:rm -rf .strapi yarn develop
替代方案
如果不想手动修复模板问题,可以放弃第三方模板,按照官方流程手动搭建集成:
- 创建基础Strapi项目
- 安装Medusa的Strapi插件
- 手动配置内容类型与Medusa的关联规则
内容的提问来源于stack exchange,提问作者Felix Le
相关产品推荐
相关产品推荐

