ronivay / XenOrchestraInstallerUpdater

Xen Orchestra install/update script
GNU General Public License v3.0
1.14k stars 190 forks source link

Install Script Keeps Detecting node.js as v16 #186

Closed kismetgerald closed 1 year ago

kismetgerald commented 1 year ago

Good-day,

I just noticed that the install script keeps detecting node.js as version 16 and attempts to install version 18.x. But when you review the install log afterwards it shows that apt didn't do anything cos it detected that node.js was already at version 18.x.

Just thought I'd call your attention to it, thanks.

ronivay commented 1 year ago

Hey,

Could you paste the relevant parts from logs (detection and install attempt). What does node -v return if you run it manually and where is that binary located command -v node? Have you installed node.js at any point using another method? If node -v is returning a 16.x binary to the install script, it will attempt to install a newer version. Only situation i can think of where this can happen is that node.js has been installed using another method and OS prefers the binary location of that node binary which is using 16.x version, therefore the script doesn't know that and always tries to install a newer version even if it's installed but binary isn't used.

kismetgerald commented 1 year ago

I may have installed node from packages, but can't recall for sure. I don't see any notes in my maintenance log, but it's quite possible that I may have. That said, even if I did, I probably would've used apt and not done anything out of the ordinary (I try not to muck around in Linux).

Well, here's the selected log output you requested:

Output of node -v: v16.16.0

Output of command -v node: /usr/local/bin/node

The detection:

[info] Checking current node.js version
[ok] node.js version is 16, upgrading to 18.x

Installation Attempt:


## Populating apt-get cache...

+ apt-get update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye-updates InRelease
Hit:3 http://security.debian.org/debian-security bullseye-security InRelease
Hit:4 https://deb.nodesource.com/node_18.x bullseye InRelease
Reading package lists...

## Confirming "bullseye" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_18.x/dists/bullseye/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null

## Creating apt sources list file for the NodeSource Node.js 18.x repo...

+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x bullseye main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x bullseye main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye-updates InRelease
Hit:3 http://security.debian.org/debian-security bullseye-security InRelease
Hit:4 https://deb.nodesource.com/node_18.x bullseye InRelease
Reading package lists...

## Run `sudo apt-get install -y nodejs` to install Node.js 18.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
     echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn

+ apt-get install -y nodejs
Reading package lists...
Building dependency tree...
Reading state information...
nodejs is already the newest version (18.16.0-deb-1nodesource1).
0 upgraded, 0 newly installed, 0 to remove and 66 not upgraded.
ronivay commented 1 year ago

Thank you. The fact that command -v output is saying node location to be under /usr/local/bin suggests that you may have indeed used some other method to install node in the past and since that location is preferred, it's being used instead of the one installed by this script. The package from nodesource should put the binary under /usr/bin/node. Could you check if that /usr/local/bin/node is a symlink to somewhere else with eq. stat /usr/local/bin/node and/or readlink -e /usr/local/bin/node if that gives a hint.

kismetgerald commented 1 year ago

As requested:

Output of stat /usr/local/bin/node

  File: /usr/local/bin/node
  Size: 81180048        Blocks: 158560     IO Block: 4096   regular file
Device: ca01h/51713d    Inode: 155020      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-05-17 04:44:41.633829676 -0400
Modify: 2022-08-05 15:59:42.487750397 -0400
Change: 2022-08-05 16:28:58.148983210 -0400
 Birth: 2022-08-05 15:59:42.287749562 -0400

Output of readlink -e /usr/local/bin/node /usr/local/bin/node

ronivay commented 1 year ago

Okay it isn't a symlink so most likely not installed by eq. using n. It's getting a bit difficult to give clear instructions how to go forward with this as it seems to be something done outside of this script, unfortunately. I'd suggest trying to figure out where that binary has come from and uninstall the package. One option to try to verify if it is indeed from a package is to use something like apt-file:

apt install apt-file apt-file update apt-file search /usr/local/bin/node

kismetgerald commented 1 year ago

Thanks for the hints Roni, I was able to resolve the issue by running apt purge nodejs. Then I re-run the installer and selected upgrade, now it successfully detects that NodeJS v18 is already installed and doesn't attempt to install it.