Can't build Kibana: yarn build

Hello, I created a custom connector like Pargerduty, the connector is working localhost perfectly.
However I cannot build the projectm I got the following error.
Actually, even if git clone the project and do not change the code, I can't build as well. I am running git bash as administrator
Kindly see below the command.

Kibana version is 7.16.3
Node version is 16.13.0
Windows 10 PRO, x64

$ yarn build
yarn run v1.22.17
$ node scripts/build --all-platforms
 info [  global  ] Verifying environment meets requirements
   │ succ Node.js version verified
   │ succ ✓ 0 sec

 info [  global  ] Cleaning artifacts from previous builds
   │ debg Deleting patterns: [
   │        'C:\\Projects\\kibana\\build',
   │        'C:\\Projects\\kibana\\target',
   │        'C:\\Projects\\kibana\\.node_binaries'
   │      ]
   │ debg Deleted 2 files/directories
   │ succ ✓ 1 sec

 info [  global  ] Downloading node.js builds for all platforms
   │ debg Downloading shasum values for node version 16.13.0 from https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/SHASUMS256.txt
   │ debg [1/3] Attempting download to string of [https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/SHASUMS256.txt]
   │ succ Downloaded [https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/SHASUMS256.txt]
   │ debg [1/3] Attempting download of https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/node-v16.13.0-linux-x64.tar.gz sha256
   │ debg [1/3] Attempting download of https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/node-v16.13.0-darwin-arm64.tar.gz sha256
   │ debg [1/3] Attempting download of https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/node-v16.13.0-linux-arm64.tar.gz sha256
   │ debg [1/3] Attempting download of https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/node-v16.13.0-darwin-x64.tar.gz sha256
   │ debg [1/3] Attempting download of https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/win-x64/node.exe sha256
   │ debg Downloaded https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/node-v16.13.0-darwin-x64.tar.gz and verified checksum
   │ debg Downloaded https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/node-v16.13.0-linux-arm64.tar.gz and verified checksum
   │ debg Downloaded https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/node-v16.13.0-darwin-arm64.tar.gz and verified checksum
   │ debg Downloaded https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/node-v16.13.0-linux-x64.tar.gz and verified checksum
   │ debg Downloaded https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v16.13.0/win-x64/node.exe and verified checksum
   │ succ ✓ 8 sec

 info [  global  ] Extracting node.js builds for all platforms
   │ succ ✓ 6 sec

 info [  kibana  ] Copying source into platform-generic build directory
   │ succ ✓ 7 sec

 info [  kibana  ] Copying bin scripts into platform-generic build directory
   │ succ ✓ 0 sec

 info [  kibana  ] Replacing favicons with built version
   │ succ ✓ 0 sec

 info [  kibana  ] Creating some empty directories and files to prevent file-permission issues
   │ succ ✓ 0 sec

 info [  kibana  ] Creating README.md file
   │ succ ✓ 0 sec

 info [  kibana  ] Building distributable versions of Bazel packages
 info Preparing Bazel projects production build for [@elastic/apm-synthtrace, @elastic/datemath, @elastic/safer-lodash-set, @kbn/ace, @kbn/alerts, @kbn/analytics, @kbn/apm-config-loader, @kbn/apm-utils, @kbn/config, @kbn/config-schema, @kbn/crypto, @kbn/es-query, @kbn/field-types, @kbn/i18n, @kbn/interpreter, @kbn/io-ts-utils, @kbn/legacy-logging, @kbn/logging, @kbn/mapbox-gl, @kbn/monaco, @kbn/rule-data-utils, @kbn/securitysolution-autocomplete, @kbn/securitysolution-es-utils, @kbn/securitysolution-hook-utils, @kbn/securitysolution-io-ts-alerting-types, @kbn/securitysolution-io-ts-list-types, @kbn/securitysolution-io-ts-types, @kbn/securitysolution-io-ts-utils, @kbn/securitysolution-list-api, @kbn/securitysolution-list-constants, @kbn/securitysolution-list-hooks, @kbn/securitysolution-list-utils, @kbn/securitysolution-t-grid, @kbn/securitysolution-utils, @kbn/server-http-tools, @kbn/server-route-repository, @kbn/std, @kbn/timelion-grammar, @kbn/tinymath, @kbn/typed-react-router-config, @kbn/ui-framework, @kbn/ui-shared-deps-npm, @kbn/ui-shared-deps-src, @kbn/utility-types, @kbn/utils]
 info [bazel] Starting local Bazel server and connecting to it...
 info [bazel] INFO: Invocation ID: f0540502-3bdf-4363-a71a-15c573fb326e
 info [bazel] INFO: Analyzed target //packages:build (1919 packages loaded, 8397 targets configured).
 info [bazel] INFO: Found 1 target...
 info [bazel] INFO: Elapsed time: 14.898s, Critical Path: 5.56s
 info [bazel] INFO: 1 process: 1 internal.
 info [bazel]
 info All Bazel projects production builds for [@elastic/apm-synthtrace, @elastic/datemath, @elastic/safer-lodash-set, @kbn/ace, @kbn/alerts, @kbn/analytics, @kbn/apm-config-loader, @kbn/apm-utils, @kbn/config, @kbn/config-schema, @kbn/crypto, @kbn/es-query, @kbn/field-types, @kbn/i18n, @kbn/interpreter, @kbn/io-ts-utils, @kbn/legacy-logging, @kbn/logging, @kbn/mapbox-gl, @kbn/monaco, @kbn/rule-data-utils, @kbn/securitysolution-autocomplete, @kbn/securitysolution-es-utils, @kbn/securitysolution-hook-utils, @kbn/securitysolution-io-ts-alerting-types, @kbn/securitysolution-io-ts-list-types, @kbn/securitysolution-io-ts-types, @kbn/securitysolution-io-ts-utils, @kbn/securitysolution-list-api, @kbn/securitysolution-list-constants, @kbn/securitysolution-list-hooks, @kbn/securitysolution-list-utils, @kbn/securitysolution-t-grid, @kbn/securitysolution-utils, @kbn/server-http-tools, @kbn/server-route-repository, @kbn/std, @kbn/timelion-grammar, @kbn/tinymath, @kbn/typed-react-router-config, @kbn/ui-framework, @kbn/ui-shared-deps-npm, @kbn/ui-shared-deps-src, @kbn/utility-types, @kbn/utils] are complete
   │ERROR failure 16 sec
   │ERROR Error: EPERM: operation not permitted, rename 'C:\Projects\kibana\build\kibana\packages\elastic-apm-synthtrace\package.json.1352462217' -> 'C:\Projects\kibana\build\kibana\packages\elastic-apm-synthtrace\package.json'

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Hi @MichelPitz ,

Currently I don’t think our build tasks are working on windows natively. Could you please try to build it using WSL2 please?

Cheers

Hi, I installed WSL and tried today

WSL 2
Ubuntu 22.04

Got the same error:

 info All Bazel projects production builds for [@elastic/apm-synthtrace, @elastic/datemath, @elastic/safer-lodash-set, @kbn/ace, @kbn/alerts, @kbn/analytics, @kbn/apm-config-loader, @kbn/apm-utils, @kbn/config, @kbn/config-schema, @kbn/crypto, @kbn/es-query, @kbn/field-types, @kbn/i18n, @kbn/interpreter, @kbn/io-ts-utils, @kbn/legacy-logging, @kbn/logging, @kbn/mapbox-gl, @kbn/monaco, @kbn/rule-data-utils, @kbn/securitysolution-autocomplete, @kbn/securitysolution-es-utils, @kbn/securitysolution-hook-utils, @kbn/securitysolution-io-ts-alerting-types, @kbn/securitysolution-io-ts-list-types, @kbn/securitysolution-io-ts-types, @kbn/securitysolution-io-ts-utils, @kbn/securitysolution-list-api, @kbn/securitysolution-list-constants, @kbn/securitysolution-list-hooks, @kbn/securitysolution-list-utils, @kbn/securitysolution-t-grid, @kbn/securitysolution-utils, @kbn/server-http-tools, @kbn/server-route-repository, @kbn/std, @kbn/timelion-grammar, @kbn/tinymath, @kbn/typed-react-router-config, @kbn/ui-framework, @kbn/ui-shared-deps-npm, @kbn/ui-shared-deps-src, @kbn/utility-types, @kbn/utils] are complete
   │ERROR failure 49 min 49 sec
   │ERROR Error: EACCES: permission denied, rename '/mnt/c/Projects/Kibana/build/kibana/packages/elastic-apm-synthtrace/package.json.1047703173' -> '/mnt/c/Projects/Kibana/build/kibana/packages/elastic-apm-synthtrace/package.json'

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
petrypmi@petrypmi:/mnt/c/Projects/Kibana$

I changed the project folder from c:/Projects to WSL folder \wsl$\Ubuntu-22.04\home\petrypmi\kibana.
Used command "yarn build --skip-os-packages" and the error is gone, will inform soon If I can start kibana

@MichelPitz thats correct!

To add on that there is a chance for the build to went through after chore(NA): adds support for bazel packages to live anywhere by mistic · Pull Request #130833 · elastic/kibana · GitHub lands but I think its better for you to just use WSL2 anyways as we don't frequently build on a Windows machine. Also for the future it is possible that WSL would become our default recommendation for developing on Windows.

Cheers

Thank you very much for the help Tiago