# Yarn kbn bootstrap fails， A few "Permission denied" errors occurred！

**URL:** <https://discuss.elastic.co/t/yarn-kbn-bootstrap-fails-a-few-permission-denied-errors-occurred/366866>\
**Category:** Kibana\
**Created:** [September 20, 2024, 9:16am UTC](https://discuss.elastic.co/t/yarn-kbn-bootstrap-fails-a-few-permission-denied-errors-occurred/366866 "2024-09-20T09:16:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hash-yang](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hash-yang](https://discuss.elastic.co/u/hash-yang)\
**Post date:** [September 20, 2024, 9:16am UTC](https://discuss.elastic.co/t/yarn-kbn-bootstrap-fails-a-few-permission-denied-errors-occurred/366866/1 "2024-09-20T09:16:12Z")

</div>

hi, i fork the kibana respository and pull it from GitHub,and then try to build kibana on windows10 with WSL2.  
I referred to the document : [Kibana Guide](https://www.elastic.co/guide/en/kibana/8.15/development-getting-started.html#developing-on-windows).(8.15).  
My environment：  
Linux WIN-20230627BHI 5.15.153.1-microsoft-standard-WSL2  
 ![图片](https://us1.discourse-cdn.com/elastic/original/3X/d/0/d0957a67369120a3a4a817bc8cbac2be905c6715.png)

I build it with root, and the error details are as follows:

```auto
root@WIN-20230627BHI:/home/hash-yang/kibana# yarn kbn bootstrap --allow-root
yarn run v1.22.22
$ node scripts/kbn bootstrap --allow-root
[bazel] INFO: Invocation ID: 619a06ec-ed8d-49c7-87c6-856f82e369c0
[bazel] INFO: Analyzed 3 targets (1 packages loaded, 7 targets configured).
[bazel] INFO: Found 3 targets...
[bazel] ERROR: /home/hash-yang/kibana/packages/kbn-esql-ast/BUILD.bazel:27:11: Copying file failed: (Exit 1): bash failed: error executing command /bin/bash -c 'cp -f "$1" "$2"' '' packages/kbn-esql-ast/src/ast/helpers.ts bazel-out/k8-fastbuild/bin/packages/kbn-esql-ast/src/ast/helpers.ts
[bazel] 
[bazel] Use --sandbox_debug to see verbose messages from the sandbox
[bazel] cp: cannot stat 'packages/kbn-esql-ast/src/ast/helpers.ts': Permission denied
[bazel] ERROR: /home/hash-yang/kibana/packages/kbn-i18n/BUILD.bazel:32:11: Copying file failed: (Exit 1): bash failed: error executing command /bin/bash -c 'cp -f "$1" "$2"' '' packages/kbn-i18n/package.json bazel-out/k8-fastbuild/bin/packages/kbn-i18n/package.json
[bazel] 
[bazel] Use --sandbox_debug to see verbose messages from the sandbox
[bazel] cp: cannot stat 'packages/kbn-i18n/package.json': Permission denied
[bazel] ERROR: /home/hash-yang/kibana/packages/kbn-esql-ast/BUILD.bazel:27:11: Copying file failed: (Exit 1): bash failed: error executing command /bin/bash -c 'cp -f "$1" "$2"' '' packages/kbn-esql-ast/src/types.ts bazel-out/k8-fastbuild/bin/packages/kbn-esql-ast/src/types.ts
[bazel] 
[bazel] Use --sandbox_debug to see verbose messages from the sandbox
[bazel] cp: cannot stat 'packages/kbn-esql-ast/src/types.ts': Permission denied
[bazel] ERROR: /home/hash-yang/kibana/packages/kbn-esql-ast/BUILD.bazel:27:11: Copying file failed: (Exit 1): bash failed: error executing command /bin/bash -c 'cp -f "$1" "$2"' '' packages/kbn-esql-ast/src/ast_factory.ts bazel-out/k8-fastbuild/bin/packages/kbn-esql-ast/src/ast_factory.ts
[bazel] 
[bazel] Use --sandbox_debug to see verbose messages from the sandbox
[bazel] cp: cannot stat 'packages/kbn-esql-ast/src/ast_factory.ts': Permission denied
[bazel] ERROR: /home/hash-yang/kibana/packages/kbn-esql-ast/BUILD.bazel:27:11: Copying file failed: (Exit 1): bash failed: error executing command /bin/bash -c 'cp -f "$1" "$2"' '' packages/kbn-esql-ast/src/ast/constants.ts bazel-out/k8-fastbuild/bin/packages/kbn-esql-ast/src/ast/constants.ts
[bazel] 
[bazel] Use --sandbox_debug to see verbose messages from the sandbox
[bazel] cp: cannot stat 'packages/kbn-esql-ast/src/ast/constants.ts': Permission denied
[bazel] ERROR: /home/hash-yang/kibana/packages/kbn-esql-validation-autocomplete/BUILD.bazel:28:11: Copying file failed: (Exit 1): bash failed: error executing command /bin/bash -c 'cp -f "$1" "$2"' '' packages/kbn-esql-validation-autocomplete/package.json bazel-out/k8-fastbuild/bin/packages/kbn-esql-validation-autocomplete/package.json
[bazel] 
[bazel] Use --sandbox_debug to see verbose messages from the sandbox
[bazel] cp: cannot stat 'packages/kbn-esql-validation-autocomplete/package.json': Permission denied
[bazel] ERROR: /home/hash-yang/kibana/packages/kbn-esql-ast/BUILD.bazel:27:11: Copying file failed: (Exit 1): bash failed: error executing command /bin/bash -c 'cp -f "$1" "$2"' '' packages/kbn-esql-ast/src/visitor/types.ts bazel-out/k8-fastbuild/bin/packages/kbn-esql-ast/src/visitor/types.ts
[bazel] 
[bazel] Use --sandbox_debug to see verbose messages from the sandbox
[bazel] cp: cannot stat 'packages/kbn-esql-ast/src/visitor/types.ts': Permission denied
[bazel] INFO: Elapsed time: 5.006s, Critical Path: 0.27s
[bazel] INFO: 8 processes: 8 internal.
[bazel] 
 HINT 
 HINT If experiencing problems with node_modules try `yarn kbn bootstrap --force-install` or as last resort `yarn kbn reset && yarn kbn bootstrap`
 HINT 
 ERROR [bootstrap] failed: [bazel] exited with code [1]
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

it seems that all the errors are occurred in 'packages' directory. I tried to change all the files and directories mode to 777, but it doesn't work.

---

<div class="post-metadata">

**Author:** ![hash-yang](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hash-yang](https://discuss.elastic.co/u/hash-yang)\
**Post date:** [October 23, 2024, 1:52pm UTC](https://discuss.elastic.co/t/yarn-kbn-bootstrap-fails-a-few-permission-denied-errors-occurred/366866/2 "2024-10-23T13:52:45Z")

</div>

It was resolved a few days ago. Please do not use the Root role for building; instead, follow the guidelines and use a regular role for this task.

---

<div class="post-metadata">

**Author:** ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)\
**Post date:** [October 23, 2024, 9:53pm UTC](https://discuss.elastic.co/t/yarn-kbn-bootstrap-fails-a-few-permission-denied-errors-occurred/366866/3 "2024-10-23T21:53:15Z")

</div>

Thanks for sharing your solution, @hash-yang.
