medusajs/medusa · critical · Error
Unable to resolve plugin "${pluginPath}". Make sure the plug
Error message
Unable to resolve plugin "${pluginPath}". Make sure the plugin directory has a package.json file What it means
While collecting Medusa plugins, the loader reads `<pluginPath>/package.json`. If reading fails with MODULE_NOT_FOUND or ENOENT, the path does not point to a resolvable package directory and startup aborts.
Source
Thrown at packages/core/utils/src/common/get-resolved-plugins.ts:39
/**
* Returns the absolute path to the package.json file for a
* given plugin identifier.
*/
async function resolvePluginPkgFile(
rootDirectory: string,
pluginPath: string
): Promise<{ path: string; contents: any }> {
try {
const pkgJSONPath = require.resolve(path.join(pluginPath, "package.json"), {
paths: [rootDirectory],
})
const packageJSONContents = JSON.parse(
await fs.readFile(pkgJSONPath, "utf-8")
)
return { path: pkgJSONPath, contents: packageJSONContents }
} catch (error) {
if (error.code === "MODULE_NOT_FOUND" || error.code === "ENOENT") {
throw new Error(
`Unable to resolve plugin "${pluginPath}". Make sure the plugin directory has a package.json file`
)
}
throw error
}
}
/**
* Reads the "medusa-plugin-options.json" file from the plugin root
* directory and returns its contents as an object.
*/
async function resolvePluginOptions(
pluginRootDir: string
): Promise<Record<string, any>> {
try {
const contents = await fs.readFile(
path.join(pluginRootDir, MEDUSA_PLUGIN_OPTIONS_FILE_PATH),
"utf-8"View on GitHub (pinned to 5e06e544a2)
Solutions
- Install the plugin package (yarn add medusa-plugin-foo)
- Fix the resolve path to the plugin package root that contains package.json
- For local plugins, point at the directory containing package.json (or src per plugin layout)
Example fix
// before
plugins: [{ resolve: "medusa-plugin-myshop" }]
// after (after running: yarn add medusa-plugin-myshop)
plugins: [{ resolve: "medusa-plugin-myshop" }] Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs')
for (const p of config.plugins ?? []) {
const pkg = require.resolve(`${p.resolve}/package.json`)
if (!fs.existsSync(pkg)) throw new Error(`plugin ${p.resolve} not installed`)
} Try / catch
try { defineConfig(config) } catch (e) { if (/Unable to resolve plugin/.test(e.message)) check installs/paths; else throw e } Prevention
- Add a postinstall check or CI step verifying each plugin resolves
- Pin plugin versions in package.json
When it happens
Trigger: Listing a plugin in medusa-config `plugins: [{ resolve: "medusa-plugin-foo" }]` where the package isn't installed, is misspelled, or the path lacks a package.json (e.g. pointing at a file or a dist folder only).
Common situations: Forgot to npm/yarn install the plugin, typo in plugin name, pointing resolve at a subfolder like ./plugins/foo/src, or a plugin whose publish config omits files.
Related errors
- Module ${moduleConfig.resolve} doesn't have a serviceName. P
- Invalid modules configuration. Should be an array or object.
- The specified PostgreSQL database does not exist. Please cre
- The specified connection string for your PostgreSQL database
- Migrations missing. Please run 'medusa migrations run' and t
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/b717eac18361e9a4.
Report an issue: GitHub.