Is there a proper way to install local plugin's dependencies?

I found the issue related to this question.

but I cannot find npm run setup command

My temporary fix is adding postinstall script on package.json.
Is it a proper way to do it?

  "scripts": {
    "postinstall": "npm i --prefix plugins/my-plugin1 && npm i --prefix plugins/my-plugin2"

That command was from the alpha, what version of Strapi are you using currently?

Im currently using 3.1.7 and planning upgrade to 3.2.5

Any update on this issue?

@darron1217 let me poke some of our backend engineers as I believe these should be installed but want to confirm.

@alexandrebodin @Convly @Pierre_Noel

Hi, there are not setup or anything like that in v3. A plugin is an npm package so all its dependencies are automatically installed when doing npm install plugin-name

Clarification for that means you need to move the dependencies into your main package.json and not the custom plugin one.

Got it.
But on developing phase, it would be handy if I can install local plugin’s dependencies through strapi-cli
Anyway, thank you all :slight_smile:

I still don’t understand what you mean about installing dependencies with strapi-cli ? why not make your app a monorepo so you can install dependencies in the plugins folder too ?

There is a feature called “Workspaces”, which helps you to setup multiple packages in such a way that you only need to run yarn install once to install all of them in a single pass.
To achieve this start using yarn instead of npm. As npm released workspaces just a few weeks ago for v7 (which is available with Node v15).

Add workspaces to the package.json, In your case your local plugins that are under development. Please note that "private": true property is mandatory when working with workspaces.

  "private": true,
  "workspaces": [

Now run yarn install, it will install all your packages from ./plugins/{plugin-name}/package.json. Also it will create a symlink for your plugin inside the node_modules:

1 Like

This is exactly what I meant :grinning:

Thanks for your kind answer!

1 Like