Bug 38426

Summary: Node.js v18 EOL around 25.05 release time
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jake.deery, jonathan.druart, kyle, matt.blenkinsop, paul.derscheid, pedro.amorim, tomascohen, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 38167    
Bug Blocks:    
Attachments: Bug 38426: Remove @vue/cli-service as it's scheduled for deprecation and not in use anymore

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.