Kibana plugin helpers error

Hi,

I developed a kibana plugin for kibana version 7.9.0. I setup the development environment following this.

Now I want to generate the zip of the developed plugin. I tried follow the steps mentioned here but while running the following command yarn add --dev link:../../kibana/packages/kbn-plugin-helpers

I get the following error:
OS: System Linux 5.8.11-1-MANJARO

[user@user-81fv kibana]$ yarn add --dev link:packages/kbn-plugin-helpers
yarn add v1.22.5
$ node ./preinstall_check
[1/5] Validating package.json...
[2/5] Resolving packages...
warning Resolution field "typescript@3.9.5" is incompatible with requested version "typescript@~3.7.2"
[3/5] Fetching packages...
warning Pattern ["@kbn/plugin-helpers@link:packages/kbn-plugin-helpers"] is trying to unpack in the same destination "/home/chaitanya/.cache/yarn/v6/npm-@kbn-plugin-helpers-9.0.2/node_modules/@kbn/plugin-helpers" as pattern ["@kbn/plugin-helpers@9.0.2","@kbn/plugin-helpers@9.0.2","@kbn/plugin-helpers@9.0.2","@kbn/plugin-helpers@9.0.2","@kbn/plugin-helpers@9.0.2"]. This could result in non-deterministic behavior, skipping.
info fsevents@1.2.12: The platform "linux" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "@kbn/analytics > @kbn/babel-preset > babel-plugin-styled-components@1.10.7" has unmet peer dependency "styled-components@>= 2".
warning " > less-loader@5.0.0" has unmet peer dependency "less@^2.3.1 || ^3.0.0".
warning " > @elastic/eslint-config-kibana@0.15.0" has incorrect peer dependency "eslint-plugin-react-hooks@^2.3.0".
warning " > grunt-karma@3.0.2" has incorrect peer dependency "karma@^3.0.0 || ^4.0.0".
warning "workspace-aggregator-89b738ed-f060-43bc-94a2-4b823a24900d > x-pack > @elastic/apm-rum-react@1.1.2" has incorrect peer dependency "react-router-dom@^4.0.0".
warning "workspace-aggregator-89b738ed-f060-43bc-94a2-4b823a24900d > x-pack > react-shortcuts@2.0.1" has incorrect peer dependency "react@^0.14.8 || ^15".
warning "workspace-aggregator-89b738ed-f060-43bc-94a2-4b823a24900d > x-pack > react-shortcuts@2.0.1" has incorrect peer dependency "react-dom@^0.14.8 || ^15".
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/home/chaitanya/projects/kibana/packages/kbn-plugin-helpers/node_modules/@types'".
info If you think this is a bug, please open a bug report with the information provided in "/home/chaitanya/projects/kibana/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

if I run the same command i.e., yarn add --dev link:../../kibana/packages/kbn-plugin-helpers again it succeeds. But then I get an error in the next step:

command: yarn kbn bootstrap

[user@user kibana]$ yarn kbn bootstrap
yarn run v1.22.5
$ node scripts/kbn bootstrap
ERROR [bootstrap] failed:
ERROR [kibana] depends on [@kbn/plugin-helpers] but should be using a workspace. Update its package.json to the expected value below.
 info Additional debugging info:

 │ info actual: "@kbn/plugin-helpers": "link:/home/chaitanya/projects/7.9/packages/kbn-plugin-helpers"
 │      expected: "@kbn/plugin-helpers": "9.0.2"
 │      package: kibana (/home/chaitanya/projects/7.9/package.json)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

if I do the changes to package.json as suggested in the error, bootstrapping succeeds. but plugin-helpers command is still not available.

so I run this node node_modules/@kbn/plugin-helpers/bin/plugin-helpers where I can find the plugin helpers.

After this I get this error:

Task "build" failed:

Error: Command failed with exit code 1: yarn install --production --pure-lockfile
error An unexpected error occurred: "https://registry.yarnpkg.com/@elastic%2fsafer-lodash-set: Not found".
yarn install v1.22.5
[1/5] Validating package.json...
[2/5] Resolving packages...
info If you think this is a bug, please open a bug report with the information provided in "/home/chaitanya/projects/7.9/build/kibana/kibana/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
    at makeError (/home/chaitanya/projects/7.9/node_modules/execa/lib/error.js:59:11)
    at Function.module.exports.sync (/home/chaitanya/projects/7.9/node_modules/execa/index.js:188:17)
    at Object.createBuild (/home/chaitanya/projects/7.9/packages/kbn-plugin-helpers/target/tasks/build/create_build.js:97:25)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Hey @K_Chaitanya!

We've made a lot of changes to plugins recently, and things are all fixed up and working great in 7.10. Would you mind checking out the 7.x branch of the Kibana repo, generating a new plugin with node scripts/generate_plugin, and then moving your code over to that new plugin? (it will be located in the plugins directory of the Kibana checkout)

You should be able to create a build of your plugin that is installable in 7.9, and hopefully the APIs your plugin uses will work in 7.9 as well, but you should have better luck moving forward if you adopt the 7.10 way of doing things now rather than waiting for it to be released.

In 7.10, since plugins are developed within the Kibana repo, you don't need to install packages like @kbn/plugin-helpers. Instead you can just import then and they will be available because the Kibana node_modules directory is in a parent directory of your plugin.

Thank you @spalger, it worked like a charm.

1 Like

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