{"record":{"id":"b717eac18361e9a4","repo":"medusajs/medusa","slug":"unable-to-resolve-plugin-pluginpath-make-sur","errorCode":null,"errorMessage":"Unable to resolve plugin \"${pluginPath}\". Make sure the plugin directory has a package.json file","messagePattern":"Unable to resolve plugin \"(.+?)\"\\. Make sure the plugin directory has a package\\.json file","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/core/utils/src/common/get-resolved-plugins.ts","lineNumber":39,"sourceCode":"/**\n * Returns the absolute path to the package.json file for a\n * given plugin identifier.\n */\nasync function resolvePluginPkgFile(\n  rootDirectory: string,\n  pluginPath: string\n): Promise<{ path: string; contents: any }> {\n  try {\n    const pkgJSONPath = require.resolve(path.join(pluginPath, \"package.json\"), {\n      paths: [rootDirectory],\n    })\n    const packageJSONContents = JSON.parse(\n      await fs.readFile(pkgJSONPath, \"utf-8\")\n    )\n    return { path: pkgJSONPath, contents: packageJSONContents }\n  } catch (error) {\n    if (error.code === \"MODULE_NOT_FOUND\" || error.code === \"ENOENT\") {\n      throw new Error(\n        `Unable to resolve plugin \"${pluginPath}\". Make sure the plugin directory has a package.json file`\n      )\n    }\n    throw error\n  }\n}\n\n/**\n * Reads the \"medusa-plugin-options.json\" file from the plugin root\n * directory and returns its contents as an object.\n */\nasync function resolvePluginOptions(\n  pluginRootDir: string\n): Promise<Record<string, any>> {\n  try {\n    const contents = await fs.readFile(\n      path.join(pluginRootDir, MEDUSA_PLUGIN_OPTIONS_FILE_PATH),\n      \"utf-8\"","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/utils/src/common/get-resolved-plugins.ts#L21-L57","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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)"],"exampleFix":"// before\nplugins: [{ resolve: \"medusa-plugin-myshop\" }]\n// after (after running: yarn add medusa-plugin-myshop)\nplugins: [{ resolve: \"medusa-plugin-myshop\" }]","handlingStrategy":"validation","validationCode":"const fs = require('fs')\nfor (const p of config.plugins ?? []) {\n  const pkg = require.resolve(`${p.resolve}/package.json`)\n  if (!fs.existsSync(pkg)) throw new Error(`plugin ${p.resolve} not installed`)\n}","typeGuard":null,"tryCatchPattern":"try { defineConfig(config) } catch (e) { if (/Unable to resolve plugin/.test(e.message)) check installs/paths; else throw e }","preventionTips":["Add a postinstall check or CI step verifying each plugin resolves","Pin plugin versions in package.json"],"tags":["plugins","config","file-not-found","startup"],"backgroundTag":"module-not-found","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}