Fix: handle missing plugin with proper error message

This commit is contained in:
derrickmehaffy 2023-01-23 07:30:15 -07:00
parent 7ab3dc34d8
commit 3814f95afc

View File

@ -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))) {