Bug 38426 - Node.js v18 EOL around 25.05 release time
Summary: Node.js v18 EOL around 25.05 release time
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 38770
Blocks:
  Show dependency treegraph
 
Reported: 2024-11-12 14:09 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2025-02-24 12:55 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 38426: Remove @vue/cli-service as it's scheduled for deprecation and not in use anymore (112.98 KB, patch)
2024-11-12 15:41 UTC, Paul Derscheid
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2024-11-12 14:09:42 UTC
We need to plan to migrate our used Node.js version to the latest LTS available. EOL dates:

https://endoflife.date/nodejs
Comment 1 Tomás Cohen Arazi (tcohen) 2024-11-12 14:38:58 UTC
I made a quick check in `KTD` which was not successful:

```shell
sudo vim /etc/apt/sources.list.d/nodesource.list
# switched 18 -> 20
sudo apt update; sudo apt install nodejs
```

after that, I tried to reinstall our node-related tools, replicating what the `KTD` build does:

```shell
sudo su -
$ cp /kohadevbox/koha/package.json .
$ cp /kohadevbox/koha/yarn.lock .
$ yarn install --modules-folder /kohadevbox/node_modules
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
error @achrinza/node-ipc@9.2.5: The engine "node" is incompatible with this module. Expected version "8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18". Got "20.18.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
```

I then tried telling yarn to upgrade things


```shell
rm -rf /kohadevbox/node_modules/*
yarn --modules-folder /kohadevbox/node_modules upgrade
chown -R 501 /kohadevbox/node_modules/
mv /root/.cache/Cypress /kohadevbox && chown -R 501 /kohadevbox/Cypress
cp package.json /kohadevbox/koha
cp yarn.lock /kohadevbox/koha
```

Things that worked:

* yarn api:bundle
* yarn cypress run
* yarn prettier koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts

Things that DIDN'T work

* yarn js:build
* yarn css:build
Comment 2 Paul Derscheid 2024-11-12 15:39:39 UTC
It seems that @vue/cli-service | vue-cli is in maintenance mode and its use is discouraged.

We should remove it because I think we are not using it anyway since we are past the scaffolding.

https://github.com/vuejs/vue-cli?tab=readme-ov-file
Comment 3 Paul Derscheid 2024-11-12 15:41:50 UTC
Created attachment 174422 [details] [review]
Bug 38426: Remove @vue/cli-service as it's scheduled for deprecation and not in use anymore
Comment 4 Paul Derscheid 2024-11-12 16:09:44 UTC
Correction: @vue/cli-service is used by Cypress unfortunately. Looking for a way around it.
Comment 5 Victor Grousset/tuxayo 2024-11-12 16:11:55 UTC
Confirmed that @vue/cli-service really really doesn't seem needed.

I also ended up proposing it's removal in a commit in Bug 38167 and I remember asking around stuff to test in our JS tooling to spot regressions. (for that ticket and another were I submitted other changes like that.) And no issue found :)

> Correction: @vue/cli-service is used by Cypress unfortunately. Looking for a way around it.

It's use is actually dead code: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38167#c4
Comment 6 Paul Derscheid 2024-11-12 17:24:13 UTC
It would maybe make sense to make this bug dependent on Bug 38149 and Bug 38167, so that we don't duplicate what needs to be done for compat with node v22.
Comment 7 Paul Derscheid 2024-11-12 17:24:55 UTC
Because tuxayo's patches already solve the problems lined out by Tomás here.
Comment 8 Jake Deery 2024-11-14 11:43:05 UTC
Hey all,

Can confirm that these set of steps are what I did today, 14th Nov:

```shell
$ sudo sed 's/18.x/20.x/g' -i /etc/apt/sources.list.d/nodesource.list
$ sudo apt update ; sudo apt install nodejs -y
$ sudo su -
$ rm -rf /kohadevbox/node_modules
$ cp /kohadevbox/koha/package.json .
$ cp /kohadevbox/koha/yarn.lock .
$ yarn install --modules-folder /kohadevbox/node_modules
$ exit ## out of sudo
$ yarn api:bundle ## ok
$ yarn cypress run ## fail
$ yarn prettier koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts ## ok
$ yarn js:build ## ok
$ yarn css:build ## ok
```

So, once Cypress is sorted, I think we'd be in a good shape to look at next steps.

Jake.
Comment 9 Victor Grousset/tuxayo 2024-12-14 13:23:51 UTC
Now that this depends on Bug 38167, there is no effective diff remaining in the patch here after applying on top of Bug 38167 and solving the conflicts.

Should the patch be obsoleted? While keeping the usual signoff workflow. Because we have a test plan even without the patch. Because we are testing a change in the node version with the test plan. It fits the process in the end.

If some other patch is needed for node upgrade then we would have patches again here.

-----

In Bug 38503 we test by upgrading to node 22.
And here it's node 20.
Both are LTS? Should we aim for 22?

v20 with it's EOL 30 Apr 2026 won't outlast Koha 25.05
Comment 10 Victor Grousset/tuxayo 2024-12-14 13:48:01 UTC
What's the issue with the Cypress tests?
I had a lot of flaky tests but by telling Cypress to retry they pass on the 1st retry.
(Instead of rerunning them)

+++ b/cypress.config.ts
@@ -6,6 +6,7 @@ export default defineConfig({
     videosFolder: "t/cypress/videos",
     defaultCommandTimeout: 10000,
     requestTimeout: 10000,
+    retries: 2,

------------------------------------

Except UsageReports_spec.ts

     AssertionError: Timed out retrying after 10000ms: expected '[{"erm_usage_muses.year":"2023","erm_usage_muses.report_type":"PR","erm_usage_muses.month":[1,2,3,4],"erm_usage_muses.metric_type":["Searches_Platform","Total_Item_Investigations","Total_Item_Requests","Unique_Item_Investigations","Unique_Item_Requests","Unique_Title_Investigations","Unique_Title_Requests"]}]' to include '2022'
      at Context.eval (webpack://koha/./t/cypress/integration/ERM/UsageReports_spec.ts:337:13)

With the screenshots of retries showing and empty table. "No data available in the table"

------------------------------------

But that's not the topic as it happens with node 18,20 and 22.
Comment 11 Victor Grousset/tuxayo 2024-12-22 09:00:47 UTC
bug 38770 is for the removal of @vue/cli-service and babel which is needed here and in another ticket. That's why it has it's own ticket. Because here we might identify more stuff needed for node > 18 support.
Comment 12 David Nind 2025-01-02 21:59:08 UTC
Not sure of the "Needs signoff" status - no patches to sign off...
Comment 13 Victor Grousset/tuxayo 2025-01-03 04:28:48 UTC
We have pieces of a test plan even without a patch: Comment 1. And comment 8 for a bit more test cases at the end.
And there is the dependency on the patch from bug 38770.

But yes it looks weird. Because the change will be outside of Koha's repository.

So not having an explicit test plan doesn't help.

=== Test plan ===
1. Follow Bug 38770 test plan
2. Test the following things to actually test the node upgrade (It's not the main point of Bug 38770)
3. yarn api:bundle
4. yarn cypress run
5. sudo yarn add prettier --modules-folder /kohadevbox/node_modules
6. yarn prettier koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts
7. sudo yarn remove prettier --modules-folder /kohadevbox/node_modules
   That mess is because we don't have bug 38149
8. yarn js:build
9. yarn css:build

Feel free to post an updated version if I forgot or mistaken things while piecing things together.


comment 1 mentions these not working.
* yarn js:build
* yarn css:build

and comment 8 mentions cypress not working

These work on my side. So if they work for someone else, we can safely signoff.
Comment 14 David Nind 2025-01-03 17:58:42 UTC
Thanks Victor!

I'll attempt to test once bug 38770 applies again.

David
Comment 15 David Nind 2025-01-04 09:53:47 UTC
Everything as per the test plan in comment #13 worked for me.

Signing off!
Comment 16 Katrin Fischer 2025-01-15 15:10:54 UTC
There is no patch here and no link in URL - where is the code? :)
Comment 17 Tomás Cohen Arazi (tcohen) 2025-02-24 12:55:09 UTC
(In reply to Katrin Fischer from comment #16)
> There is no patch here and no link in URL - where is the code? :)

The bug is umbrella-ish, and depends on others.