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

Required node version in packages.json from release tar.gz so old I cannot build kibana for Archlinux users anymore. #193648

Closed
ipaqmaster opened this issue Sep 21, 2024 · 5 comments
Labels
bug Fixes for quality problems that affect the customer experience Team:Operations Team label for Operations Team

Comments

@ipaqmaster
Copy link

ipaqmaster commented Sep 21, 2024

Kibana version:

kibana-8.15.1

Elasticsearch version:

NA

Server OS version:

Archlinux, kernel 6.6.51-1-lts

Browser version:

NA

Browser OS version:

NA

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

Download from the releases bar on the right of this repository

Describe the bug:

No sane way to build and package Kibana on Archlinux. I currently maintain the Arch User Repository package for Kibana which takes the tar.gz release from this repository and in a set of instructions, extracts it and bundles it with some service files into an installable package. The package manager can then install this and you can start the kibana service. Very clean and easy.

The past quarter year this has stopped working. (See #188498) When starting the kibana service it immediately throws Error: Cannot find module 'require-in-the-middle' which tells me some node module is no longer included in the tar.gz or something else has gone horribly out of check (Perhaps this module was part of a node package on this distro which has been replaced with a newer one. Or something)

I've been trying to have this package simply get the node modules itself but trying to do this has been nothing but headaches. The extracted tarball wants to use Node 20.15.1 according to package.json and this is a rolling release distro so the packaged nodejs is a current version: 22.9.0. There is the option of the nodejs-lts-iron package in the extra repository (extra/nodejs-lts-iron) which is version 20.17.0 which still doesn't match but this is the closest official package I can use compared with the version desired in package.json.


Trying yarn kbn bootstrap throws

$ yarn kbn bootstrap
yarn run v1.22.22
error [email protected]: The engine "node" is incompatible with this module. Expected version "20.15.1". Got "20.17.0"
error Commands cannot run with an incompatible environment.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Trying npm install throws:

$ npm install
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/react-router-dom
npm error   react-router-dom@"^5.3.4" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react-router-dom@">=6.0.0" from @elastic/[email protected]
npm error node_modules/@elastic/apm-rum-react
npm error   @elastic/apm-rum-react@"^2.0.3" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/username/.npm/_logs/2024-09-21T02_32_35_834Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/username/.npm/_logs/2024-09-21T02_32_35_834Z-debug-0.log

and throws additional errors when trying --force or --legacy-peer-deps as suggested in the error output.


I have attempted countless and aimless workarounds for this. Even trying sed -i 's/20.15.1/20.17.0/g' package.json and trying yarn kbn bootstrap again which fails due to attempting to write to the system top level directories instead of relatively to this extracted tarball (Where I want to put them to include them in packaging):

$ yarn kbn bootstrap
yarn run v1.22.22
$ node scripts/kbn bootstrap
info installing Bazel tools
ff ERROR  [bootstrap] failed: [npm] exitted with 243:
          output:
            npm error code EACCES
            npm error syscall mkdir
            npm error path /usr/lib/node_modules/@bazel
            npm error errno -13
            npm error Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@bazel'

There does not seem to be a flag for changing this to bootstrap node_modules in this relative path! (For building the modules into the package).

Upon trying yarn install with the same sed version overwrite I get some success with a lot of warnings and the kibana package build successfully but upon installing the package and running the kibana service it fails with: Error: Cannot find module './polyfill' !


My next step would be to painstakingly trace scripts/kbn and figure out how to relatively install them myself but I wanted to make this issue before getting to that point in a week's time. But I get the feeling yarn install already took care of the missing pieces of node_packages -- I'm hoping there's a simple way to fix this polyfill issue as seen in the sed+yarn-install route I took. But I'm at a point where time is being wasted and kibana does not have a working package for the current version for Archlinux users, which I would rather not be the case.

Steps to reproduce:

  1. Please see above troubleshooting

Expected behavior:

Being able to build a working kibana package for Archlinux users from this tar.gz release. (This is what I do, but as of a few months ago modules are missing on startup and trying to hack slash and build the node_modules with the tarball and a supported nodejs release fails every way I slice it)

Screenshots (if relevant):

NA

Errors in browser console (if relevant):

NA

Provide logs and/or server output (if relevant):

Any additional context:

I'm not the best with software written with node and the familiar cli programs for preparing to run a project but I've tried what's detailed above and a lot more to try and get this working with no luck.

I'm trying not to rely on nvm because it's not in the official repositories for Archlinux so anyone trying to also build the kibana Archlinux User Repository package I maintain here would have to rely on it too.

@ipaqmaster ipaqmaster added the bug Fixes for quality problems that affect the customer experience label Sep 21, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Sep 21, 2024
@ipaqmaster ipaqmaster changed the title How are we supposed to package Kibana for Archlinux? -- node version in package.json is no longer supported plus countless build issues. Required node version in packages.json from release tar.gz so old I cannot build kibana for Archlinux users anymore. Sep 21, 2024
@jughosta jughosta added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Sep 24, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Sep 24, 2024
@afharo afharo added Team:Operations Team label for Operations Team and removed Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Sep 25, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@Ikuni17
Copy link
Contributor

Ikuni17 commented Sep 26, 2024

Hi @ipaqmaster, we cannot provide support for unofficial installations, operating systems, or Node versions. For Kibana, we tend to upgrade when a security fix is released for LTS. For reference 20.15.1 was released on 2024-07-08.

My suggestion would be to directly use the Node binary which is always bundled with Kibana at <kibana root>\node\glibc-217\bin and will be the version Kibana has been tested with and is expected to use.

@Ikuni17 Ikuni17 closed this as completed Sep 26, 2024
@ipaqmaster
Copy link
Author

ipaqmaster commented Sep 27, 2024

There is no node binary in this repository's release tar.gz.

I managed to make npm install --force work by replacing the link: references with file: in package.json but even after it installs the required dependencies kibana still fails to start with Error: Cannot find module './polyfill'. This is so close to being workable yet I can't get any help on the topic.

Further attempts to get this project to build matching the desired node version using nvm install and nvm use followed by yarn kbn bootstrap --allow-root in the build process throws:

success shared bundles built
UNHANDLED EXCEPTION: Error: Cannot find module '@kbn/repo-info'
Require stack:
- /zfstmp/kibana-xpack/src/kibana-8.15.2/packages/kbn-babel-register/cache/index.js
- /zfstmp/kibana-xpack/src/kibana-8.15.2/packages/kbn-babel-register/index.js
- /zfstmp/kibana-xpack/src/kibana-8.15.2/kbn_pm/src/lib/external_packages.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/zfstmp/kibana-xpack/src/kibana-8.15.2/packages/kbn-babel-register/cache/index.js:15:40)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
error Command failed with exit code 1.

I've got nvm installing a local npm and local yarn. I think this is on the right track and have continued trying to get this going.

Even launching this resulting kibana installation built with the correct nodejs version via nvm and running yarn kbn bootstrap it still launches with:

Error: Cannot find module './polyfill'
Require stack:
- /usr/share/kibana/src/setup_node_env/dist.js
- /usr/share/kibana/src/cli/dist.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Function.Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at Module.patchedRequire (/usr/share/kibana/node_modules/require-in-the-middle/index.js:194:34)
    at Module.Hook._require.Module.require (/usr/share/kibana/node_modules/require-in-the-middle/index.js:142:27)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/usr/share/kibana/src/setup_node_env/dist.js:11:1)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)

This is a mess.

@ipaqmaster
Copy link
Author

Cloning this repository (Up to commit 760455a) and running these commands works flawlessly: clear ; git clean -fdx ; source /usr/share/nvm/init-nvm.sh && export NVM_DIR=.nvm && nvm install && nvm use && npm install yarn -g && yarn kbn reset && yarn kbn bootstrap

Doing the same on the release tar.gz (Which is what the AUR package builds from) throws UNHANDLED EXCEPTION: Error: Cannot find module '@kbn/repo-info'. I think this is a real problem.

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:Operations Team label for Operations Team
Projects
None yet
Development

No branches or pull requests

5 participants