diff --git a/docs/content/advanced/backend/plugins/create.md b/docs/content/advanced/backend/plugins/create.md index 50c8b4fd03..f702afca88 100644 --- a/docs/content/advanced/backend/plugins/create.md +++ b/docs/content/advanced/backend/plugins/create.md @@ -22,6 +22,10 @@ Where `medusa-plugin-custom` is the name of the plugin you’re creating. In Med By convention, all plugin names start with `medusa` followed by a descriptive name of what the plugin does. For example, the Stripe plugin is named `medusa-payment-stripe`. +### Rename Project Name + +Update the `name` field in the `package.json` file to the name of your plugin. This should be the same name that you chose when running the `medusa new` command. + ### Project Structure The command above creates a new directory `medusa-plugin-custom` that holds essentially the same codebase you would have for a Medusa server. This is because a plugin has the same directory structure as a Medusa server. @@ -266,6 +270,50 @@ Finally, start your server and test your plugin’s functionalities: npm run start ``` +### Troubleshoot Errors + +#### Error: The class must be a valid service implementation + +Please make sure that your plugin is following the correct structure. If the error persists then please try the following fix: + +```bash npm2yarn +cd /node_modules/medusa-interfaces +npm link +cd +rm -rf node_modules/medusa-interfaces +npm link medusa-interfaces +npm link +cd +npm link your-plugin +``` + +Where `` is the path to your Medusa server and `` is the path to your plugin. + +This links the `medusa-interfaces` package from your `medusa-backend` to your plugin directory and then links your plugin to your `medusa-backend`. + +#### APIs not loading + +If the APIs you added to your Medussa server are not loading then please try the following steps: + +```bash npm2yarn +cd +rm -rf node_modules +cd /node_modules/ +npm install +cd +npm build +cd +npm start +``` + +Where `` is the path to your Medusa server, `` is the path to your plugin and `` is the name of your plugin as it is in your plugin `package.json` file. + +:::note + +It is safe to ignore any `cross-env: command not found` error you may receive. + +::: + ## NPM Ignore File Not all files that you use while developing your plugin are necessary to be published.