From 3814f95afcc29e2a241ca5ed1fe4faab90b403f1 Mon Sep 17 00:00:00 2001 From: derrickmehaffy Date: Mon, 23 Jan 2023 07:30:15 -0700 Subject: [PATCH] Fix: handle missing plugin with proper error message --- packages/core/strapi/lib/core/loaders/plugins/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/strapi/lib/core/loaders/plugins/index.js b/packages/core/strapi/lib/core/loaders/plugins/index.js index d7b1b8e39b..4996f692a5 100644 --- a/packages/core/strapi/lib/core/loaders/plugins/index.js +++ b/packages/core/strapi/lib/core/loaders/plugins/index.js @@ -85,7 +85,15 @@ const loadPlugins = async (strapi) => { for (const pluginName of Object.keys(enabledPlugins)) { const enabledPlugin = enabledPlugins[pluginName]; - const serverEntrypointPath = join(enabledPlugin.pathToPlugin, 'strapi-server.js'); + let serverEntrypointPath; + + try { + serverEntrypointPath = join(enabledPlugin.pathToPlugin, 'strapi-server.js'); + } catch (e) { + throw new Error( + `Error loading plugin ${pluginName}, plugin is not installed, please install the plugin or remove it's configuration.` + ); + } // only load plugins with a server entrypoint if (!(await fse.pathExists(serverEntrypointPath))) {