# Yarn build --skip-os-packages --release removes added dependencies

**URL:** <https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417>\
**Category:** Kibana\
**Tags:** kibana-plugin-development\
**Created:** [February 15, 2024, 10:59pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417 "2024-02-15T22:59:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [February 15, 2024, 10:59pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417/1 "2024-02-15T22:59:51Z")

</div>

We have a plugin that we have built that we are now needing to add additional dependencies to. `yarn add react-paginate@^8.2.0 react-tooltip@^5.26.2`  
`yarn kbn bootstrap` respects that these dependencies exist and will include them in the node\_modules. Which gets us through development.

When we move towards `yarn build --skip-os-packages --release` to build the `kibana-8.8.0-linux-x86_64.tar.gz` that process omits the new dependencies

we see this in the output that is impacting our node\_modules which are not included in the `kibana-8.8.0-linux-x86_64.tar.gz`.

```auto
info [kibana] Creating build-ready version of package.json

[911](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L911) │ succ ✓ 17 sec

[912](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L912) info [kibana] Installing node_modules, including production builds of packages

[913](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L913) │ debg $ /root/.nvm/versions/node/v16.19.1/lib/node_modules/yarn/bin/yarn.js install --non-interactive --production --ignore-optional --pure-lockfile --prefer-offline --no-bin-links

[914](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L914) │ debg [1/5] Validating package.json...

[915](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L915) │ debg [2/5] Resolving packages...

```

How are others adding new dependencies that your plugins need to the Kibana deployment?

---

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [February 16, 2024, 3:27pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417/2 "2024-02-16T15:27:42Z")

</div>

Further into my investigation I found that the yarn build does look at a  
`Kibana\packages\kbn-find-used-node-modules` which does a rebuild of the package.json based on the peer modules used in Kibana's base package which is why the node\_modules are not present when building the kibana-8.8.0-linux-x86\_64.tar.gz . this leads us to believe that the plugin itself with the node.lock and package.json can install additional node\_modules when a plugin is installed into the Base install of Kibana. We are investigating this next path and hope this is the case because we do see that a plugin install does hit the setup\_node\_env.

---

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [February 20, 2024, 2:54pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417/3 "2024-02-20T14:54:41Z")

</div>

We are still having issues with getting the additional node\_modules installed during the plugin install if there is anyone that can provide some guidance on how to add node\_modules that we wish to use in our plugins.

---

<div class="post-metadata">

**Author:** ![gsoldevila](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gsoldevila/32/107150_2.png) [@gsoldevila](https://discuss.elastic.co/u/gsoldevila)\
**Post date:** [February 27, 2024, 4:19pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417/4 "2024-02-27T16:19:14Z")

</div>

Are you adding these new dependencies in the root level `package.json` by any chance?  
I believe they should be added in `plugins/<plugin name>/package.json` instead.

---

<div class="post-metadata">

**Author:** ![JSFern83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsfern83/32/130537_2.png) [@JSFern83](https://discuss.elastic.co/u/JSFern83)\
**Post date:** [February 27, 2024, 7:47pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417/5 "2024-02-27T19:47:38Z")

</div>

So when the build of Kibana is being made, any plugins that have added npm packages in them have to be in the plugins folder for those packages to be included?

---

<div class="post-metadata">

**Author:** ![JSFern83](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsfern83/32/130537_2.png) [@JSFern83](https://discuss.elastic.co/u/JSFern83)\
**Post date:** [March 4, 2024, 10:36pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417/6 "2024-03-04T22:36:19Z")

</div>

Is there a way to reference the node\_modules locally in the plugin itself instead of it looking for the node\_module in the main Kibana build?

---

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [March 7, 2024, 3:06pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417/7 "2024-03-07T15:06:13Z")

</div>

Hey @gsoldevila we see the node\_modules do end up in the `<plugin name>/node_modules` is there a way to reference the node\_modules that the plugins need from that folder rather then the kibana/node\_modules folder?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 4, 2024, 3:07pm UTC](https://discuss.elastic.co/t/yarn-build-skip-os-packages-release-removes-added-dependencies/353417/8 "2024-04-04T15:07:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
