You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Strapi集成Cloudinary时缺失File模型,应用无法启动求助

Strapi应用启动失败:File模型缺失报错求助

应用启动时出现如下报错:

Error: The model `File`, used in the attribute `Image` in the model Portfolio-card, is missing from the (plugin - upload) models

我使用MongoDB数据库搭配strapi-connector-mongoose连接,已按文档配置相关文件,但应用仍无法启动。以下是我的配置文件:

package.json

{
  "name": "czarogrod-backend-strapi",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "strapi": "3.6.11",
    "strapi-admin": "3.3.4",
    "strapi-connector-mongoose": "3.3.4",
    "strapi-plugin-content-manager": "3.1.3",
    "strapi-plugin-content-type-builder": "3.1.3",
    "strapi-plugin-email": "3.1.3",
    "strapi-provider-upload-cloudinary": "^3.1.3",
    "strapi-utils": "3.1.3",
    "video-react": "0.16.0",
    "webpack": "^4.44.1"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "2474ae8d-dfcf-46d2-9167-e53366ff5737"
  },
  "engines": {
    "node": "^16.x",
    "npm": "^6.x"
  },
  "license": "MIT"
}

config/plugins.js

module.exports = ({ env }) => ({
  upload: {
    config: {
      provider: "cloudinary",
      providerOptions: {
        cloud_name: env("CLOUDINARY_NAME"),
        api_key: env("CLOUDINARY_KEY"),
        api_secret: env("CLOUDINARY_SECRET"),
      },
      actionOptions: {
        upload: {},
        uploadStream: {},
        delete: {},
      },
    },
  },
});

config/middlewares.js

module.exports = [
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "dl.airtable.com",
            "res.cloudinary.com",
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            "dl.airtable.com",
            "res.cloudinary.com",
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
];

extensions/upload/config.js

{
  "provider": "cloudinary",
  "providerOptions": {
    "cloud_name": "###",
    "api_key": "###",
    "api_secret": "###"
  }
}

恳请各位提供帮助,谢谢!


内容的提问来源于stack exchange,提问作者Velrin Black

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 20:10:48