# \[7.2\] Kibana plugin development possible bug

**URL:** <https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672>\
**Category:** Kibana\
**Created:** [October 22, 2019, 2:50pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672 "2019-10-22T14:50:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 22, 2019, 2:50pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/1 "2019-10-22T14:50:46Z")

</div>

Hi there!

I'm having some problems developing a kibana plugin for this specific Kibana version.  
If I make EXACTLY the same steps which I'm about to describe to develop the plugin for version 7.0 or 7.1 or even 7.3, it works flawlessly. With version 7.2 I have the following error.

My steps are:

`git clone https://github.com/elastic/kibana`  
`cd kibana`  
`git checkout 7.2`

Here I can see the `.node-version` is the same I am using (10.15.2). Perfect.

`yarn kbn bootstrap`

Here it gives me some warnings like:

```
warning Resolution field "core-js@2.5.3" is incompatible with requested version "core-js@^2.6.5"
warning Resolution field "@types/node@10.12.27" is incompatible with requested version "@types/node@8.5.8"
warning Resolution field "@types/node@10.12.27" is incompatible with requested version "@types/node@8.5.8"
warning Resolution field "@types/node@10.12.27" is incompatible with requested version "@types/node@8.5.8"
warning Resolution field "@types/node@10.12.27" is incompatible with requested version "@types/node@8.5.8"
[3/5] Fetching packages...
info fsevents@1.2.7: The platform "linux" is incompatible with this module.
info "fsevents@1.2.7" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > @elastic/charts@4.2.6" has incorrect peer dependency "@elastic/eui@10.4.1".
warning "workspace-aggregator-bc398412-e147-4630-89fa-8201a4e98573 > x-pack > @mapbox/mapbox-gl-draw@1.1.1" has inco
rrect peer dependency "mapbox-gl@>=0.27.0 <=0.51.0".
warning "workspace-aggregator-bc398412-e147-4630-89fa-8201a4e98573 > x-pack > react-shortcuts@2.0.0" has incorrect p
eer dependency "react@^0.14.8 || ^15".
warning "workspace-aggregator-bc398412-e147-4630-89fa-8201a4e98573 > x-pack > react-shortcuts@2.0.0" has incorrect p
eer dependency "react-dom@^0.14.8 || ^15".
warning "workspace-aggregator-bc398412-e147-4630-89fa-8201a4e98573 > x-pack > graphql-code-generator > @graphql-modu
les/epoxy@0.1.9" has unmet peer dependency "@graphql-modules/logger@*".

```

But it keeps bootstrapping and finally succeeds.  
Then I go

```
`node scripts/generate_plugin.js my_sample_plugin` answering:
`? Provide a short description This is a sample plugin`
`? What Kibana version are you targeting? 7.2.2`
`? Should an app component be generated? Yes`
`? Should translation files be generated? No`
`? Should a hack component be generated? No`
`? Should a server API be generated? Yes`
`? Should SCSS be used? Yes`

```

It keeps loading (returning the same above-mentioned warnings) and it finally says:

```
Bootstrapping completed!

Done in 168.27s.
success 🎉

  Your plugin has been created in plugins/my_sample_plugin. Move into that directory to run it:

    cd "plugins/my_sample_plugin"
    yarn start

```

Which is exactly what it says with version 7.3.  
Problem is that now if I go to `plugins/my_sample_plugin` and run `yarn start` it immediately returns the error:

```
yarn run v1.19.1
warning package.json: No license field
$ plugin-helpers start
Task "start" failed:

Error: spawnSync node ENOENT
    at Object.spawnSync (internal/child_process.js:990:20)
    at spawnSync (child_process.js:601:24)
    at execFileSync (child_process.js:629:13)
    at module.exports (/home/fabio/Scrivania/kibana_7.2_test_plugin/kibana/packages/kbn-plugin-helpers/tasks/start/start_action.js:43:3)
    at run (/home/fabio/Scrivania/kibana_7.2_test_plugin/kibana/packages/kbn-plugin-helpers/lib/run.js:30:10)
    at Command.<anonymous> (/home/fabio/Scrivania/kibana_7.2_test_plugin/kibana/packages/kbn-plugin-helpers/lib/commander_action.js:27:13)
    at Command.listener (/home/fabio/Scrivania/kibana_7.2_test_plugin/kibana/packages/kbn-plugin-helpers/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:189:13)
    at Command.parseArgs (/home/fabio/Scrivania/kibana_7.2_test_plugin/kibana/packages/kbn-plugin-helpers/node_modules/commander/index.js:654:12)
    at Command.parse (/home/fabio/Scrivania/kibana_7.2_test_plugin/kibana/packages/kbn-plugin-helpers/node_modules/commander/index.js:474:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

This thing is really driving me nuts since I really need to develop the plugin for the 7.2 version and apparently that is the only version returning this error.

At first I thought it was linked to the fact the from version 7.1 to 7.2 they changed the folder where the plugin is created (from `kibana-extra/` sibling of `kibana/` to the `plugins/` which is a child of `kibana/`) but then I tried with version 7.3 which creates the plugin inside the `plugins/` folder as well and it worked, so I really do not know what to do about it.

Thank you for your support!

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 22, 2019, 3:03pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/2 "2019-10-22T15:03:27Z")

</div>

Check here may help [https://github.com/elastic/kibana/issues/16784](https://github.com/elastic/kibana/issues/16784)

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 22, 2019, 3:04pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/3 "2019-10-22T15:04:22Z")

</div>

Also, I checked the differences between those files return in the errors (e.g. `/home/fabio/Scrivania/kibana_7.2_test_plugin/kibana/packages/kbn-plugin-helpers/tasks/start/start_action.js` and all the others) and the equivalent files of the 7.3 version and they are identical (I used the `diff` linux command).

Any ideas?

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 22, 2019, 3:18pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/4 "2019-10-22T15:18:36Z")

</div>

> Check here may help [Building plugin, yarn start is missing bin/kibana · Issue #16784 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/16784)

Hi and thanks for the tip.

Though, I tried setting `export KIBANA_ROOT="/home/fabio/Scrivania/kibana_7.2_test_plugin/kibana"` but it doesn't seem to work anyway. Now it returns

```
`Error: The 'KIBANA_ROOT' environment variable has been removed from '@kbn/plugin- helpers'. During development your plugin must be located in '../kibana-extra/{pluginName}' relative to the Kibana directory to work with this package.`

```

Which makes me laugh because it automatically creates it into the `plugins/` folder.  
Though, I tried moving it into the `../kibana-extra/` folder (relative to `kibana/`) but it doesn't work and returns

```
yarn run v1.19.1
warning package.json: No license field
$ plugin-helpers start
/bin/sh: 1: plugin-helpers: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

I think the suggestion to move it into `../kibana-extra/` is a old one which they forgot to remove.

So, what am I missing?

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 22, 2019, 3:25pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/5 "2019-10-22T15:25:41Z")

</div>

Could your help :  
1- What OS you are using ?  
2. What branch did you clone from github ?

I used to work with all 7.x and master (8) under window and never get this error

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 22, 2019, 3:31pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/6 "2019-10-22T15:31:52Z")

</div>

I'm using Linux Mint 18.3 KDE and I cloned the master branch as you can see from the steps in the first message of the thread.

But again I find it so strange that only version 7.2 gives me that error. Neither the previous versions nor the following ones. Unbelievable.

If you follow those steps won't you get that error?

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 22, 2019, 3:37pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/7 "2019-10-22T15:37:26Z")

</div>

try with checking out a stable tag  
`git checkout tags/v7.2.0`

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 22, 2019, 4:07pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/8 "2019-10-22T16:07:00Z")

</div>

Same problem.

I tried `git checkout tags/v7.2.0` as you suggested. Run the `yarn kbn bootstrap` and the `node scripts/generate_plugin my_plugin` again.

When it comes to run the `yarn start` from inside the `my_plugin` folder it returns the usual error.

Do you think there will might be any error if I develop the plugin for the 7.3 version and then downgrade it in the `package.json` to the 7.2?

Yet, I find it incredible 🤔

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 22, 2019, 4:10pm UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/9 "2019-10-22T16:10:53Z")

</div>

did you tried `yarn start` outside of plugins folder, from Kibana home for example  
Check if `plugins/my_plugin` contains a folder `node_modules`  
Usually we develop under master and we build against a stable release 7.4, 7.3 and 7.2 with no issues

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 23, 2019, 7:47am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/10 "2019-10-23T07:47:05Z")

</div>

Yes, if I run `yarn start` from the `kibana/` folder it runs. Now I'm about to replace the `node_modules/` folder in the `kibana/plugins/my_plugin/` folder with the one from `kibana/` and see if it works.

If it doesn't, I'll make another post with all my steps from the cloning of the repo to the failing `yarn start` with all the screenshots so it's gonna be easier for you helping me debug it.

Thanks

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 23, 2019, 7:56am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/11 "2019-10-23T07:56:04Z")

</div>

Usually when i use `node scripts/generate_plugin my_plugin` it create automtically `node_modules` in all plugins under `$KIBANA_HOME/plugins`

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 23, 2019, 8:03am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/12 "2019-10-23T08:03:44Z")

</div>

Exactly and in fact it does create the `node_modules` inside `$KIBANA_HOME/plugins/my_plugin`. Problem is that `yarn start` works in `$KIBANA_HOME` but not in `$KIBANA_HOME/plugins/my_plugin` and I cannot understand why.

It only happens with version 7.2.x, not with version 7.1, nor with 7.3.

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 23, 2019, 8:47am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/13 "2019-10-23T08:47:44Z")

</div>

Here's the step-by-step procedure I followed:

1. Create a folder `KIBANA_PLUGIN_TEST_7.2` inside the `Desktop` and move there  

2. Cloning the kibana repo from github (`git clone https://github.com/elastic/kibana.git`)  

3. Cd into the cloned kibana repo (`cd kibana`) and check the git status (`git st`) to verify I'm on branch master  

4. Checking out to stable version 7.2.0 (`git co tags/v7.2.0`)  

5. Run `yarn kbn bootstrap` from inside the `kibana/` folder (you can see the warnings while bootstrapping)  

6. Bootstrapping successfully completed and working `yarn start` from `kibana/` folder  

7. Generate the `my_plugin` plugin (`node scripts/generate_plugin.js my_plugin`) with all the due choices  

8. See the usual warnings during the plugin generation  

9. Plugin successfully generated  

10. Move into `plugins/my_plugin` and run `yarn start`. Damn error is returned  

I want to point out my `node --version` returns v10.15.2, so it should be ok.

Sorry for the length of the post but this way you can really follow me throughout all the steps.  
What is going wrong and WHY only with the 7.2?

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 23, 2019, 9:20am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/14 "2019-10-23T09:20:24Z")

</div>

Try to run `yarn kbn bootstrap` inside the generated plugin then run `yarn start`

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 23, 2019, 9:59am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/15 "2019-10-23T09:59:25Z")

</div>

Same problem 🙅‍♂️

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 23, 2019, 10:12am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/16 "2019-10-23T10:12:32Z")

</div>

Very strange your case 🙂  
In [https://github.com/elastic/kibana/tree/master/packages/kbn-plugin-generator](https://github.com/elastic/kibana/tree/master/packages/kbn-plugin-generator)  
There is a big \> _ **NOTE:** _ All of these scripts should be run from the generated plugin.

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 23, 2019, 10:17am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/17 "2019-10-23T10:17:17Z")

</div>

Yep but the first time I guess I have to run `yarn kbn bootstrap` from the `kibana/` folder, otherwise I do not think the `node scripts/generate_plugin.js` would properly run.

Then, I tried everything (also running `yarn kbn bootstrap` from inside the plugin folder) but it always returns the same error.

As I said, I think I'll try to develop the plugin for the 7.3 and then (after the build) I'll simply change in the package json the `7.3.3` to `7.2.0`. Do you think there will be any compatibility problems?

Thank you

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [October 23, 2019, 10:29am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/18 "2019-10-23T10:29:13Z")

</div>

Go ahead with 7.3 or even with 7.4, you may have small issues but really minor, some enhancement or breaking changes in UI components ([https://elastic.github.io/eui/#/](https://elastic.github.io/eui/#/))

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 23, 2019, 10:51am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/19 "2019-10-23T10:51:30Z")

</div>

I think I'll go with that!

Thank you. Anyway, if I found an explanation to all this, I'll write it here.

P.S. think I'm gonna try it out on a different Linux distro, too.

---

<div class="post-metadata">

**Author:** ![Fabio-sama](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@Fabio-sama](https://discuss.elastic.co/u/Fabio-sama)\
**Post date:** [October 24, 2019, 9:19am UTC](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672/20 "2019-10-24T09:19:01Z")

</div>

Ok I guess I found the problem with the help of a colleague of mine.

Reading the error there's a call to `kbn-plugin-helpers/tasks/start/start_action.js`.

Going back through all the linked files we noticed there's a line in `packages/kbn-plugin-helpers/lib/plugin_config.js` which refers to the old folder structure, calling the path `../../kibana` as if the plugin was placed inside the old `kibana-extra` folder.

The error

```
`Error: The 'KIBANA_ROOT' environment variable has been removed from '@kbn/plugin- helpers'. During development your plugin must be located in '../kibana-extra/{pluginName}' relative to the Kibana directory to work with this package.`

```

should have rung a bell about it.

Then we went with `git blame packages/kbn-plugin-helpers/lib/plugin_config.js` from which you can see that Tiago Costa applied a fix to that path in commit `e4830625`.

Thus, running `git show e4830625 | git apply` from v7.2.0 branch, you can see that some files got modified

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/8/984feb3f38690859e01fc9cf9eb3becd3e97392a.png)

It'll then be sufficient to add the edits (`git add .`) and commit ignoring the linter (`git commit -m "whatever" --no-verify`).

Now, running the `yarn kbn bootstrap`, `node scripts/generate_plugin.js my_plugin` and `cd plugins/my_plugin/`, `yarn start` everything works as expected.

It's kinda strange that such an important fix is not mentioned anywhere (apart from git history) and I really do not understand how it could work on your environment.  
You sure replicated my exact steps, cloning the repo, checking out to 7.2.0 and running everything else without changing anything? Since it really shouldn't work because of that wrong path.

Anyway, hope this thread will be of help to anybody who needs to develop a plugin for Kibana 7.2.x.

[Next page](https://discuss.elastic.co/t/7-2-kibana-plugin-development-possible-bug/204672.md?page=2)
