devonfw / ide

Tool to automate setup and update of development environment (esp. for Java projects).
Apache License 2.0
35 stars 101 forks source link

devon node version set buggy #1098

Closed hohwille closed 1 year ago

hohwille commented 1 year ago
$ devon node version set v16.
v16.0.0   v16.10.0  v16.11.1  v16.13.0  v16.13.2  v16.14.1  v16.15.0  v16.16.0  v16.17.1  v16.18.1  v16.3.0   v16.4.1   v16.5.0   v16.6.1   v16.7.0   v16.9.0
v16.1.0   v16.11.0  v16.12.0  v16.13.1  v16.14.0  v16.14.2  v16.15.1  v16.17.0  v16.18.0  v16.2.0   v16.4.0   v16.4.2   v16.6.0   v16.6.2   v16.8.0   v16.9.1

$ devon node version set v16.10.0
NODEJS_VERSION="v16.10.0" has been set in /d/projects/test/settings/devon.properties
To install that version call the following command:
devon node setup

$ devon node setup
Success: run command mkdir
Starting installation of nodejs in version 16.10.0 to /d/projects/test/software/node
Trying to download nodejs-16.10.0-windows.zip from https://nodejs.org/dist/16.10.0/node-16.10.0-win-x64.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
Failed to download https://nodejs.org/dist/16.10.0/node-16.10.0-win-x64.zip with exit code 22

******** ATTENTION ********
Download of nodejs in version 16.10.0 failed after trying 1 mirror(s).
We are sorry for the inconvenience. Please check the above errors, resolve them and try again.

In devon.properties the config line NODEJS_VERSION="16.10.0" had been added without the leading v. After manually adding the v in devon.properties the setup of node worked. So for some unknown reason devon version setting is omitting the leading v here...

hohwille commented 1 year ago

It seems the actual bug is that the property name was wrong (will be fixed with #1085): The variable in devon.properties added by devon node version set v16.10.0 was NODEJS_VERSION as you could also see in the log output. This IMHO happens because doGetToolFolderName transforms node to nodejs and then converts this to UPPERCASE with awk resulting in NODEJS_VERSION instead of NODE_VERSION. It is great when all this mess will end with #1085

hohwille commented 1 year ago

We should also consider for epic #941 if we should consistently decide if the version should be as is and defined by the tool vendor or if we want to remove artificial prefixes like v from the version. Currently it seems that some commandlet follows philosophy A while then next commandlet goes for philosophy B.