Kibana: This plugin is using `link:` dependencies for non-Kibana packages

Created on 11 Jul 2019  ·  16Comments  ·  Source: elastic/kibana

Kibana version:
7.2.0

Elasticsearch version:
7.2.0

Server OS version:
macOS v10.14.5 (Mojave)

Browser version:
Chrome Version 75.0.3770.100 (Official Build) (64-bit)

Browser OS version:
macOS v10.14.5 (Mojave)

Original install method (e.g. download page, yum, from source, etc.):
Download page, source (GitHub)

Describe the bug:
Unable to install a plugin generated by kibana/scripts/generate_plugin.

Steps to reproduce:

  1. Setup Kibana repository
$ git clone [email protected]:elastic/kibana.git
$ cd kibana
$ yarn kbn bootstrap
  1. Generate plugin
$ node scripts/generate_plugin myplugin
? Provide a short description An awesome Kibana plugin
? What Kibana version are you targeting? master
? Should an app component be generated? Yes
? Should translation files be generated? Yes
? Should a hack component be generated? Yes
? Should a server API be generated? Yes
? Should SCSS be used? Yes
  1. Wait until the plugin generated
  2. Build the plugin
$ cd plugins/myplugin/
$ yarn build
yarn run v1.16.0
warning package.json: No license field
plugin-helpers build
? What version of Kibana are you building for? 7.2.0
✨  Done in 9.00s.
  1. Setup Kibana distro
$ wget https://artifacts.elastic.co/downloads/kibana/kibana-7.2.0-darwin-x86_64.tar.gz
$ tar -xzvf kibana-7.2.0-darwin-x86_64.tar.gz
$ cd kibana-7.2.0-darwin-x86_64
  1. Install the generated plugin
$ ./bin/kibana-plugin install file:///path/to/kibana/plugins/myplugin/build/myplugin-0.0.0.zip 
Attempting to transfer from file:///path/to/kibana/plugins/myplugin/build/myplugin-0.0.0.zip
Transferring 88211 bytes....................
Transfer complete
Retrieving metadata from plugin archive
Extracting plugin archive
Extraction complete
Plugin installation was unsuccessful due to error "This plugin is using `link:` dependencies for non-Kibana packages"

Expected behavior:
I can install the generated plugin.

Plugin bootstrap:

srgbnd:kibana srgbnd$ node scripts/generate_plugin myplugin
? Provide a short description An awesome Kibana plugin
? What Kibana version are you targeting? master
? Should an app component be generated? Yes
? Should translation files be generated? Yes
? Should a hack component be generated? Yes
? Should a server API be generated? Yes
? Should SCSS be used? Yes
Initialized empty Git repository in /Users/srgbnd/Development/kibana/kibana/plugins/myplugin/.git/
yarn run v1.16.0
$ node scripts/kbn bootstrap
Running [bootstrap] command from [/Users/srgbnd/Development/kibana/kibana]:

Found [37] projects:

kibana
�� packages
   �� elastic-datemath (@elastic/datemath)
   �� eslint-config-kibana (@elastic/eslint-config-kibana)
   �� kbn-babel-code-parser (@kbn/babel-code-parser)
   �� kbn-babel-preset (@kbn/babel-preset)
   �� kbn-config-schema (@kbn/config-schema)
   �� kbn-dev-utils (@kbn/dev-utils)
   �� kbn-elastic-idx (@kbn/elastic-idx)
   �� kbn-es-query (@kbn/es-query)
   �� kbn-es (@kbn/es)
   �� kbn-eslint-import-resolver-kibana (@kbn/eslint-import-resolver-kibana)
   �� kbn-eslint-plugin-eslint (@kbn/eslint-plugin-eslint)
   �� kbn-expect (@kbn/expect)
   �� kbn-i18n (@kbn/i18n)
   �� kbn-interpreter (@kbn/interpreter)
   �� kbn-maki (@kbn/maki)
   �� kbn-plugin-generator (@kbn/plugin-generator)
   �� kbn-plugin-helpers (@kbn/plugin-helpers)
   �� kbn-pm (@kbn/pm)
   �� kbn-spec-to-console (spec-to-console)
   �� kbn-test-subj-selector (@kbn/test-subj-selector)
   �� kbn-test (@kbn/test)
   �� kbn-ui-framework (@kbn/ui-framework)
�� test
   �� plugin_functional/plugins
      �� core_plugin_a
      �� core_plugin_b
      �� kbn_tp_custom_visualizations
      �� kbn_tp_embeddable_explorer
      �� kbn_tp_sample_app_plugin
      �� kbn_tp_sample_panel_action
      �� kbn_tp_visualize_embedding
   �� interpreter_functional/plugins/kbn_tp_run_pipeline
�� x-pack (x-pack)
   �� legacy/plugins
       �� infra
       �� siem
�� ../kibana-extra/lastalert
�� plugins
    �� myplugin
    �� plugin_v_720

Running installs in topological order:


Installing dependencies in [kibana]:

$ node ./preinstall_check
[1/5] ˝  Validating package.json...
[2/5] ˝  Resolving packages...
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/[email protected]"
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/[email protected]"
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/[email protected]"
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/[email protected]"
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/node@^12.0.2"
success Already up-to-date.
Skipping workspace project: @elastic/datemath
Skipping workspace project: @elastic/eslint-config-kibana
Skipping workspace project: @kbn/babel-code-parser
Skipping workspace project: @kbn/babel-preset
Skipping workspace project: @kbn/config-schema
Skipping workspace project: @kbn/dev-utils
Skipping workspace project: @kbn/elastic-idx
Skipping workspace project: @kbn/es-query
Skipping workspace project: @kbn/es
Skipping workspace project: @kbn/eslint-import-resolver-kibana
Skipping workspace project: @kbn/eslint-plugin-eslint
Skipping workspace project: @kbn/expect
Skipping workspace project: @kbn/i18n
Skipping workspace project: @kbn/interpreter
Skipping workspace project: @kbn/maki
Skipping workspace project: @kbn/plugin-generator
Skipping workspace project: @kbn/plugin-helpers
Skipping workspace project: @kbn/pm
Skipping workspace project: spec-to-console
Skipping workspace project: @kbn/test-subj-selector
Skipping workspace project: @kbn/test
Skipping workspace project: @kbn/ui-framework

Skipping workspace project: core_plugin_a
Skipping workspace project: core_plugin_b
Skipping workspace project: kbn_tp_custom_visualizations
Skipping workspace project: kbn_tp_embeddable_explorer
Skipping workspace project: kbn_tp_sample_app_plugin
Skipping workspace project: kbn_tp_sample_panel_action
Skipping workspace project: kbn_tp_visualize_embedding
Skipping workspace project: kbn_tp_run_pipeline
Skipping workspace project: x-pack
Skipping workspace project: infra
Skipping workspace project: siem


Installing dependencies in [lastalert]:

warning package.json: No license field
$ node ../../kibana/preinstall_check
warning [email protected]: No license field
[1/4] ˝  Resolving packages...
success Already up-to-date.


Installing dependencies in [myplugin]:

warning package.json: No license field
info No lockfile found.
$ node ../../preinstall_check
warning [email protected]: No license field
[1/4] ˝  Resolving packages...
warning @kbn/i18n > [email protected]: This package has been deprecated, please see migration guide at 'https://github.com/formatjs/formatjs/tree/master/packages/intl-relativeformat#migration-guid
e'
warning @kbn/i18n > react-intl > [email protected]: This package has been deprecated, please see migration guide at 'https://github.com/formatjs/formatjs/tree/master/packages/intl-relativeformat#m
igration-guide'
[2/4] ˝  Fetching packages...
[3/4] ˝  Linking dependencies...
[4/4] ˝  Building fresh packages...
[-/3]  waiting...
[-/3]  waiting...
success Saved lockfile.


Installing dependencies in [plugin_v_720]:

warning package.json: No license field
$ node ../../preinstall_check
warning [email protected]: No license field
[1/4] ˝  Resolving packages...
success Already up-to-date.

Installs completed, linking package executables:

[kbn_tp_embeddable_explorer] plugin-helpers -> ../../../../packages/kbn-plugin-helpers/bin/plugin-helpers.js
[kbn_tp_sample_panel_action] plugin-helpers -> ../../../../packages/kbn-plugin-helpers/bin/plugin-helpers.js
[x-pack] plugin-helpers -> ../packages/kbn-plugin-helpers/bin/plugin-helpers.js
[lastalert] plugin-helpers -> ../../kibana/packages/kbn-plugin-helpers/bin/plugin-helpers.js
[myplugin] plugin-helpers -> ../../packages/kbn-plugin-helpers/bin/plugin-helpers.js
[plugin_v_720] plugin-helpers -> ../../packages/kbn-plugin-helpers/bin/plugin-helpers.js

Linking executables completed, running `kbn:bootstrap` scripts

@elastic/datemath: $ yarn build --quiet
@kbn/config-schema: $ yarn build
@kbn/elastic-idx: $ yarn build
@elastic/datemath: $ babel src --out-dir target --copy-files --quiet
@kbn/config-schema: $ tsc
@kbn/elastic-idx: $ tsc
@elastic/datemath: Successfully compiled 1 file with Babel.
@kbn/babel-code-parser: $ yarn build --quiet
@kbn/dev-utils: $ yarn build --quiet
@kbn/dev-utils: $ babel src --out-dir target --quiet
@kbn/babel-code-parser: $ babel src --out-dir target --quiet
@kbn/babel-code-parser: Successfully compiled 7 files with Babel.
@kbn/dev-utils: Successfully compiled 23 files with Babel.
@kbn/i18n: $ node scripts/build --source-maps
@kbn/test: $ yarn build
@kbn/test: $ babel src --out-dir target --delete-dir-on-start --extensions .ts,.js,.tsx
@kbn/i18n:  info Deleting old output
@kbn/i18n:  info Starting babel and typescript
@kbn/i18n:  info [babel:web ] > babel src --config-file /Users/srgbnd/Development/kibana/kibana/packages/kbn-i18n/babel.config.js --out-dir /Users/srgbnd/Development/kibana/kibana/pack
ages/kbn-i18n/target/web --extensions .ts,.js,.tsx --quiet --source-map inline
@kbn/i18n:  info [babel:node] > babel src --config-file /Users/srgbnd/Development/kibana/kibana/packages/kbn-i18n/babel.config.js --out-dir /Users/srgbnd/Development/kibana/kibana/pack
ages/kbn-i18n/target/node --extensions .ts,.js,.tsx --quiet --source-map inline
@kbn/i18n:  info [tsc       ] > tsc --emitDeclarationOnly --declarationMap true
@kbn/test: Successfully compiled 21 files with Babel.
@kbn/i18n:  proc [babel:node] Successfully compiled 17 files with Babel.
@kbn/i18n:  info [babel:node] exited with 0 after a few seconds
@kbn/i18n:  proc [babel:web ] Successfully compiled 17 files with Babel.
@kbn/i18n:  info [babel:web ] exited with 0 after a few seconds
@kbn/i18n:  info [tsc       ] exited with 0 after a few seconds
@kbn/i18n:  succ Complete
@kbn/es-query: $ node scripts/build --source-maps
@kbn/interpreter: $ node scripts/build --dev
@kbn/es-query:  info Deleting old output
@kbn/interpreter:  info Deleting old output
@kbn/interpreter:  info Starting babel
@kbn/interpreter:  info [babel  ] > babel src --ignore *.test.js --out-dir target --copy-files --source-maps inline --quiet
@kbn/es-query:  info Starting babel and typescript
@kbn/es-query:  info [babel:public] > babel src --config-file /Users/srgbnd/Development/kibana/kibana/packages/kbn-es-query/babel.config.js --out-dir /Users/srgbnd/Development/kibana/k
ibana/packages/kbn-es-query/target/public --extensions .js,.ts,.tsx --quiet --source-map inline
@kbn/es-query:  info [babel:server] > babel src --config-file /Users/srgbnd/Development/kibana/kibana/packages/kbn-es-query/babel.config.js --out-dir /Users/srgbnd/Development/kibana/k
ibana/packages/kbn-es-query/target/server --extensions .js,.ts,.tsx --quiet --source-map inline
@kbn/interpreter:  proc [babel  ] Successfully compiled 15 files with Babel.
@kbn/es-query:  proc [babel:server] Successfully compiled 62 files with Babel.
@kbn/interpreter:  info [babel  ] exited with 0 after a few seconds
@kbn/interpreter:  succ Complete
@kbn/es-query:  info [babel:server] exited with 0 after a few seconds
@kbn/es-query:  proc [babel:public] Successfully compiled 62 files with Babel.
@kbn/es-query:  info [babel:public] exited with 0 after a few seconds
@kbn/es-query:  succ Complete
kibana: $ yarn build:types && node scripts/register_git_hook
x-pack: $ node legacy/plugins/canvas/scripts/clean_storybook_dll
kibana: $ tsc --p tsconfig.types.json
kibana: Registering Kibana pre-commit git hook...
kibana: success Kibana pre-commit git hook was installed successfully.

Bootstrapping completed!

(  Done in 127.01s.
success ˝

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

    cd "plugins/myplugin"
    yarn start
Core Operations bug

All 16 comments

In the unpublished @kbn package I see this

$ grep -rn "This plugin is using" ../kibana
../kibana/node_modules/@kbn/pm/dist/index.js:55262:      throw new Error('This plugin is using `link:` dependencies for non-Kibana packages');
...
    if (Object(_utils_package_json__WEBPACK_IMPORTED_MODULE_0__["isLinkDependency"])(depVersion) && !isKibanaDep(depVersion)) {
      // For non-Kibana packages we need to set up symlinks during the
      // installation process, but this is not something we support yet.
      throw new Error('This plugin is using `link:` dependencies for non-Kibana packages');
    }

Thus link dependency I got in the generated plugin doesn't really work, right?

Here the packages.json of the plugin

$ pwd
/path/to/kibana/plugins/myplugin
$ cat package.json 
{
  "name": "myplugin",
  "version": "0.0.0",
  "description": "An awesome Kibana plugin",
  "main": "index.js",
  "kibana": {
    "version": "7.2.0",
    "templateVersion": "1.0.0"
  },
  "scripts": {
    "preinstall": "node ../../preinstall_check",
    "kbn": "node ../../scripts/kbn",
    "es": "node ../../scripts/es",
    "lint": "eslint .",
    "start": "plugin-helpers start",
    "test:server": "plugin-helpers test:server",
    "test:browser": "plugin-helpers test:browser",
    "build": "plugin-helpers build"
  },
  "dependencies": {
    "@kbn/i18n": "link:../../packages/kbn-i18n"
  },
  "devDependencies": {
    "@elastic/eslint-config-kibana": "link:../../packages/eslint-config-kibana",
    "@elastic/eslint-import-resolver-kibana": "link:../../packages/kbn-eslint-import-resolver-kibana",
    "@kbn/expect": "link:../../packages/kbn-expect",
    "@kbn/plugin-helpers": "link:../../packages/kbn-plugin-helpers",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.16.0",
    "eslint-plugin-babel": "^5.3.0",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-jest": "^22.4.1",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-mocha": "^5.3.0",
    "eslint-plugin-no-unsanitized": "^3.0.2",
    "eslint-plugin-prefer-object-spread": "^1.2.1",
    "eslint-plugin-react": "^7.12.4"
  }
}

Pinging @elastic/kibana-operations

I found the same error. As a workaround while this is not fixed, you can create the plugin the way you did and then move it to the kibana-extra directory (that should be sibling to kibana directory).

Also, replace the links in package.json, to point to kibana directory: ../../kibana

I am having the same error message while installing my plugin to a Kibana instance. Is there any update? I am using Kibana version 7.3.0 .

@elastic/kibana-platform this seems related to the plugin path changes. Could someone take a look?

Having the same issue, Kibana 7.3.0

What worked for me was placing all kibana related dependencies to devDependencies. Hope this helps

"devDependencies": {
    "@elastic/eslint-config-kibana": "link:../../packages/eslint-config-kibana",
    "@elastic/eslint-import-resolver-kibana": "link:../../packages/kbn-eslint-import-resolver-kibana",
    "@kbn/expect": "link:../../packages/kbn-expect",
    "@kbn/plugin-helpers": "link:../../packages/kbn-plugin-helpers"
  },

The plugin I had to make changes to started working probably so this approach may help you as well.

hello,
I get the same issue, I found this cause reason is in package.json file which include the below lines:
....
"dependencies": {
"@kbn/i18n": "link:../../packages/kbn-i18n"
},
....
It works well if I remove "@kbn/i18n": "link:../../packages/kbn-i18n" line.
But, I want to know how to handle this issue If I need this dependecies? and I found this package is existed in this folder.

i got the same issue, and the reason i found is the dependency of "@kbn/i18n": "link:../../packages/kbn-i18n" in package json file. i just move this dependency into dev dependencies, and it works, the translation works well too.

I came across similar kind of issue. The way I solved is to use file: prefix instead of link: prefix. ie. "@kbn/i18n": "file:../../packages/kbn-i18n". yarn build created plugin zip with all such dependencies installed in node_modules of zip. I dont know if it is a standard way of doing it but it worked for me.

Thanks @fangqjj @irocnX
i'm working on 7.4.2 same issue to install build, move "@kbn/i18n": "link:../../packages/kbn-i18n"
to devDependencies works for me

That was fixed with the merge of that PR https://github.com/elastic/kibana/pull/57097 for the mentioned version tags.

@mistic closed with this PR https://github.com/elastic/kibana/pull/57472 ?

@restrry yes, it should be solved with that PR and this one https://github.com/elastic/kibana/pull/57097

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stormpython picture stormpython  ·  74Comments

AlexIoannides picture AlexIoannides  ·  138Comments

Alex-Ikanow picture Alex-Ikanow  ·  364Comments

Vineeth-Mohan picture Vineeth-Mohan  ·  149Comments

passkey1510 picture passkey1510  ·  96Comments