Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sergibondarenko opened this issue Jul 11, 2019 · 16 comments
Closed

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

sergibondarenko opened this issue Jul 11, 2019 · 16 comments
Labels
bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Operations Team label for Operations Team

Comments

@sergibondarenko
Copy link

sergibondarenko commented Jul 11, 2019

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
@sergibondarenko
Copy link
Author

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?

@sergibondarenko
Copy link
Author

sergibondarenko commented Jul 11, 2019

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"
  }
}

@mistic mistic added the Team:Operations Team label for Operations Team label Jul 15, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations

@lucasmogari
Copy link

lucasmogari commented Jul 15, 2019

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

@reza-ryte-club
Copy link

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 .

@tylersmalley tylersmalley added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Aug 29, 2019
@tylersmalley
Copy link
Contributor

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

@elastic elastic deleted a comment from elasticmachine Aug 29, 2019
@joshdover joshdover added the bug Fixes for quality problems that affect the customer experience label Aug 30, 2019
@exvmple
Copy link

exvmple commented Sep 4, 2019

Having the same issue, Kibana 7.3.0

@exvmple
Copy link

exvmple commented Sep 4, 2019

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"
  },

@exvmple
Copy link

exvmple commented Sep 5, 2019

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

@irocnX
Copy link

irocnX commented Dec 5, 2019

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.

@fangqjj
Copy link

fangqjj commented Dec 18, 2019

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.

@shaileshcheke
Copy link
Contributor

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.

mistic added a commit that referenced this issue Feb 12, 2020
* Fix paths for kibana packages in prepare_project_dependencies(#40858).

* Dist/index.js after yarn build.

* chore(NA): correctly include kbm pm new dist file

* Commit after cherry-pick 985c85c from recreation branch.

Co-authored-by: Tiago Costa <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
mistic added a commit to mistic/kibana that referenced this issue Feb 12, 2020
* Fix paths for kibana packages in prepare_project_dependencies(elastic#40858).

* Dist/index.js after yarn build.

* chore(NA): correctly include kbm pm new dist file

* Commit after cherry-pick 985c85c from recreation branch.

Co-authored-by: Tiago Costa <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
mistic added a commit to mistic/kibana that referenced this issue Feb 12, 2020
* Fix paths for kibana packages in prepare_project_dependencies(elastic#40858).

* Dist/index.js after yarn build.

* chore(NA): correctly include kbm pm new dist file

* Commit after cherry-pick 985c85c from recreation branch.

Co-authored-by: Tiago Costa <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
mistic added a commit that referenced this issue Feb 12, 2020
* Fix paths for kibana packages in prepare_project_dependencies(#40858).

* Dist/index.js after yarn build.

* chore(NA): correctly include kbm pm new dist file

* Commit after cherry-pick 985c85c from recreation branch.

Co-authored-by: Tiago Costa <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Shailesh cheke <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
mistic added a commit that referenced this issue Feb 12, 2020
* Fix paths for kibana packages in prepare_project_dependencies(#40858).

* Dist/index.js after yarn build.

* chore(NA): correctly include kbm pm new dist file

* Commit after cherry-pick 985c85c from recreation branch.

Co-authored-by: Tiago Costa <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Shailesh cheke <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
@seraphjiang
Copy link

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

@mistic
Copy link
Member

mistic commented Feb 17, 2020

That was fixed with the merge of that PR #57097 for the mentioned version tags.

@mistic mistic closed this as completed Feb 17, 2020
@mshustov
Copy link
Contributor

@mistic closed with this PR #57472 ?

@mistic
Copy link
Member

mistic commented Feb 17, 2020

@restrry yes, it should be solved with that PR and this one #57097

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Operations Team label for Operations Team
Projects
None yet
Development

No branches or pull requests