# Kibana canvas plugin create problem

**URL:** <https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [December 11, 2019, 9:28am UTC](https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440 "2019-12-11T09:28:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cheng-chieh\_Lin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheng-chieh_lin/32/49241_2.png) [@Cheng-chieh\_Lin](https://discuss.elastic.co/u/Cheng-chieh_Lin)\
**Post date:** [December 11, 2019, 9:28am UTC](https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440/1 "2019-12-11T09:28:19Z")

</div>

I followed this [Custom Kibana Canvas Elements](https://discuss.elastic.co/t/custom-kibana-canvas-elements/202632) and tried to create my Kibana canvas plugin. However, it failed with the message below when I run the `yarn kbn bootstrap` command.

```auto
kibana: $ yarn build:types && node scripts/register_git_hook
x-pack: $ node legacy/plugins/canvas/scripts/storybook --clean
kibana: $ tsc --p tsconfig.types.json
✖ kibana: Kibana should not be run as root. Use --allow-root to continue.
kibana: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
✖ kibana: error Command failed with exit code 1.

[bootstrap] failed:

Error: Command failed with exit code 1: yarn run kbn:bootstrap
    at makeError (/root/kibana/packages/kbn-pm/dist/index.js:20332:11)
    at handlePromise (/root/kibana/packages/kbn-pm/dist/index.js:19270:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

It seems like the problem is that we cannot run yarn as root.Therefore, I modified my command and ran it again:  
`yarn kbn bootstrap --allow-root`  
But, I still got the same error message. Could anyone help me to solve this problem?

My environment is _CentOS7.5_  
Kibana development folder is from the [Github](https://github.com/elastic/kibana) and switches to the master branch.  
Yarn version is _1.21.0_.  
Nodejs version is _v10.15.2_.

If there is anything unclear, please let me know. Thank you!

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [December 11, 2019, 10:24am UTC](https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440/2 "2019-12-11T10:24:07Z")

</div>

Hi @Cheng-chieh_Lin,

Ideally you should try to not run any Kibana commands with root privileges unless you absolutely have to. In any case it seems we have a bug with `--allow-root`, would you mind filing the issue at GitHub with `Team:Operations` label and reference this issue [https://github.com/elastic/kibana/pull/21563](https://github.com/elastic/kibana/pull/21563)?

The only temporary workaround I can think of is appending `--allow-root` to [this line](https://github.com/elastic/kibana/blob/master/package.json#L71):

```json
"kbn:bootstrap": "yarn build:types && node scripts/register_git_hook --allow-root",

```

Best,  
Oleg

---

<div class="post-metadata">

**Author:** ![Cheng-chieh\_Lin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheng-chieh_lin/32/49241_2.png) [@Cheng-chieh\_Lin](https://discuss.elastic.co/u/Cheng-chieh_Lin)\
**Post date:** [December 13, 2019, 4:46am UTC](https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440/3 "2019-12-13T04:46:16Z")

</div>

Hi Azasypkin

Sorry again,  
Even I updated the package.json with the `--allow-root`, it still not works. Is there any other solution? I will raise this issue later in the Github.

Below is the error message on the console and for your reference. Many thanks.

```auto
kibana: $ yarn build:types && node scripts/register_git_hook --allow-root
kibana: $ tsc --p tsconfig.types.json
kibana: Registering Kibana pre-commit git hook...
kibana: fail Kibana pre-commit git hook was not installed as an error occur.
kibana: ERROR Error: ENOENT: no such file or directory, open '/root/kibana/--git-common-dir/hooks/pre-commit'
kibana: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
✖ kibana: error Command failed with exit code 1.

[bootstrap] failed:

Error: Command failed with exit code 1: yarn run kbn:bootstrap
    at makeError (/root/kibana/packages/kbn-pm/dist/index.js:20332:11)
    at handlePromise (/root/kibana/packages/kbn-pm/dist/index.js:19270:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
error Command failed with exit code 1.

```

> [@azasypkin](#):
>
> --allow-root

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [December 13, 2019, 7:45am UTC](https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440/4 "2019-12-13T07:45:28Z")

</div>

> [@Cheng-chieh\_Lin](#):
>
> /root/kibana/--git-common-dir/hooks/pre-commit

There is something really fancy going on here. You only added `--allow-root`, right? Does this script works when you run it separately `node scripts/register_git_hook` or `node scripts/register_git_hook --allow-root` (with sudo)?

---

<div class="post-metadata">

**Author:** ![Cheng-chieh\_Lin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheng-chieh_lin/32/49241_2.png) [@Cheng-chieh\_Lin](https://discuss.elastic.co/u/Cheng-chieh_Lin)\
**Post date:** [December 16, 2019, 2:24am UTC](https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440/5 "2019-12-16T02:24:57Z")

</div>

> [@azasypkin](#):
>
> node scripts/register\_git\_hook

I tried the method you mentioned. And it told me a weird answer below.

```auto
[root@localhost kibana]# sudo node scripts/register_git_hook.js --allow-root
Kibana does not support the current Node.js version v8.16.2. Please use Node.js v10.15.2.

```

It seems like my nodejs version is not correct so I checked for it. However, the system told me that my default version is 10.15.2 and it is as same as the version Kibana required.

```auto
[root@localhost kibana]# nvm ls
-> v10.15.2
         system
default -> 10.15.2 (-> v10.15.2)
node -> stable (-> v10.15.2) (default)
stable -> 10.15 (-> v10.15.2) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/erbium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.16.2 (-> N/A)
lts/dubnium -> v10.17.0 (-> N/A)
lts/erbium -> v12.13.1 (-> N/A)

```

Is the building error reason is for my system wrong nodejs version or it is actually an issue? Or any other method I can try? Thank you!

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [December 17, 2019, 8:35am UTC](https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440/6 "2019-12-17T08:35:13Z")

</div>

> [@Cheng-chieh\_Lin](#):
>
> Is the building error reason is for my system wrong nodejs version or it is actually an issue?

It's definitely an important bit here. You should make sure first that NVM sets the proper node version for the user you run node on behalf of. It's still would be better if you can find a way to not run all these scripts on behalf of root/superuser.

---

<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:** [January 14, 2020, 8:35am UTC](https://discuss.elastic.co/t/kibana-canvas-plugin-create-problem/211440/7 "2020-01-14T08:35:14Z")

</div>

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