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
相关产品推荐
相关产品推荐

