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

A feasible solution to "upgrade" Node.js to v18.15.0 #120

Closed
primovist opened this issue Apr 4, 2023 · 37 comments
Closed

A feasible solution to "upgrade" Node.js to v18.15.0 #120

primovist opened this issue Apr 4, 2023 · 37 comments
Labels

Comments

@primovist
Copy link

primovist commented Apr 4, 2023

Update:after upgrade the NodeJs v18 package,the homebridge shows it uses v18.15.0

First of all, you need to log in to Synology with the root account SSH, and then switch the directory to /var/packages/homebridge/target/app

cd /var/packages/homebridge/target/app

Then back up and edit the source.sh file.

cp source.sh source.sh.bak

vi source.sh

Modify two positions

NODE_BIN_PATH modified to
NODE_BIN_PATH=”/var/packages/Node.js_v18/target/usr/local/bin“

export HB_NODE_EXEC_PATH modified to export HB_SERVICE_NODE_EXEC_PATH=”/var/packages/Node.js_v18/target/usr/local/bin/node“

Just save it and restart the package.
image
image

@primovist primovist changed the title A feasible solution to ”upgrade“ Node.js to v18.2.1. A feasible solution to "upgrade" Node.js to v18.2.1. Apr 4, 2023
@Lling
Copy link

Lling commented Apr 4, 2023

Tried it today and it doesn't work for me.
After a restart you cant connect to the homebridge.
On which DSM Version did you tried these workflow?

@alexiscordova
Copy link

Worked for me! Thanks @primovist

@rh295
Copy link

rh295 commented Apr 4, 2023

Worked for me on DS1821+ Thx !

@primovist
Copy link
Author

Tried it today and it doesn't work for me.

After a restart you cant connect to the homebridge.

On which DSM Version did you tried these workflow?

Need install package Node.js v18 first.

@Lling
Copy link

Lling commented Apr 5, 2023

This is installed, of course.

@primovist
Copy link
Author

This is installed, of course.

maybe DSM 7.0+?Someone posted that they can use this.
I Use DSM 7.2 beta.

@alexiscordova
Copy link

Tried it today and it doesn't work for me. After a restart you cant connect to the homebridge. On which DSM Version did you tried these workflow?

The initial instructions had the wrong variable name. Double-check that it's HB_NODE_EXEC_PATH.

Worked for me on DSM 7.1.1-42962 Update 4

@Lling
Copy link

Lling commented Apr 5, 2023

No im a litte bit confused..

`#!/bin/sh

1 - > NODE_BIN_PATH="/var/packages/homebridge/target/app/bin"

export HB_SERVICE_STORAGE_PATH="$(readlink -f /var/packages/homebridge/shares/homebridge)"
export HB_SERVICE_NODE_EXEC_PATH="/var/packages/homebridge/target/app/bin/node"
2 ->export HB_SERVICE_EXEC_PATH="/var/packages/homebridge/target/app/lib/node_modules/homebridge-config-ui-x/dist/bin/hb-service.js"
`

this is a part of my source file
The marked "1" i have to change to NODE_BIN_PATH=”/var/packages/Node.js_v18/target/usr/local/bin“
The marked "2" i have to change to export HB_SERVICE_NODE_EXEC_PATH=”/var/packages/Node.js_v18/target/usr/local/bin/node“

correct?

@primovist
Copy link
Author

No im a litte bit confused..

`#!/bin/sh

1 - > NODE_BIN_PATH="/var/packages/homebridge/target/app/bin"

export HB_SERVICE_STORAGE_PATH="$(readlink -f /var/packages/homebridge/shares/homebridge)"

export HB_SERVICE_NODE_EXEC_PATH="/var/packages/homebridge/target/app/bin/node"

2 ->export HB_SERVICE_EXEC_PATH="/var/packages/homebridge/target/app/lib/node_modules/homebridge-config-ui-x/dist/bin/hb-service.js"

`

this is a part of my source file

The marked "1" i have to change to NODE_BIN_PATH=”/var/packages/Node.js_v18/target/usr/local/bin“

The marked "3" i have to change to HB_SERVICE_NODE_EXEC_PATH=”/var/packages/Node.js_v18/target/usr/local/bin/node“

correct?

forgot 'export'?

@Lling
Copy link

Lling commented Apr 9, 2023

Don’t think so. I’ve only changed the part between the quotation marks.

@CBP980
Copy link

CBP980 commented Apr 17, 2023

I just tried this and didn't seem to work for me.

I've modified the lines mentioned.
NODE_BIN_PATH=”/var/packages/Node.js_v18/target/usr/local/bin“
and
export HB_SERVICE_NODE_EXEC_PATH=”/var/packages/Node.js_v18/target/usr/local/bin/node“

Saved file, restarted Homebridge, but when it comes up, I see the same Node.js version I saw before - 16.20.0

Node.js 18 is installed and running and as expected, that directory exists, not seeing any sort of me pointing to something that doesn't exist.

Running DSM 7.1.1-42962 Update 4 on DS920+

I'm guessing I'm missing something obvious to someone, just not me. It's a head-scratcher.

@primovist
Copy link
Author

the symbols different between “”and""?

@CBP980
Copy link

CBP980 commented Apr 17, 2023

the symbols different between “”and""?

Thank you, I adjusted that. However, still having the same problem.

NODE_BIN_PATH="/var/packages/Node.js_v18/target/usr/local/bin"
export HB_SERVICE_NODE_EXEC_PATH="/var/packages/Node.js_v18/target/usr/local/bin/node"

When I restart, the Node.js version is kept at the 16.x release.

Unsure if this is a valid test / attempt, but if I use terminal and from there, try to do a
homebridge@box:/volume1/homebridge $ hb-service update-node
ℹ Updating Node.js from v16.20.0 to v18.16.0...
✖ Cannot update Node.js on your system. Synology DSM 7 does not currently support Node.js 18 or later.

The version of Node.js that is installed on Synology is 18.12.x, but HB is trying to install a newer release. I'd have thought that should work, but just checking.

Even if this was a "problem", I tried to do an update to 18.11 (behind what I have installed) and same thing, it just isn't happy with anything 18.x. Just odd as it's saying that DSM 7 does not currently support 18.x but of course, it does.

Is NODE_BIN_PATH the same as Node.js Path and if so, then there is some issue as Node.js path is different:

Homebridge Terminal for Synology DSM

Node.js Version: v16.20.0
Node.js Path: /var/packages/homebridge/target/app/bin/node
Plugin Path: /volume1/homebridge/node_modules

Thanks!

@primovist primovist changed the title A feasible solution to "upgrade" Node.js to v18.2.1. A feasible solution to "upgrade" Node.js to v18.15.0 Apr 26, 2023
@BrendanThompson
Copy link

I can get to the last step where I need to run hb-service update-node, I am SSHed into the NAS and sudo'ed into root and I still get:

CleanShot 2023-04-28 at 09 54 50

@primovist
Copy link
Author

primovist commented Apr 28, 2023 via email

@FezVrasta
Copy link

FezVrasta commented May 6, 2023

Just to clarify, you just have to change the two variable names and then STOP and START again the Homebridge package from the Synology Package Center.

The problem is that the Hue plugin requires v18.16.0+ and Synology only provides 18.12.0 🤷‍♂️ No big deal as it works with 18.12.0 too just fine though.

Complete instructions:

  1. SSH into the Synology shell.
  2. Run the following commands:
    sudo su
    sed -i.bak 's/\/var\/packages\/homebridge\/target\/app\/bin/\/var\/packages\/Node.js_v18\/target\/usr\/local\/bin/g' /var/packages/homebridge/target/app/source.sh
  3. Go to Synology Package Center and stop and then start the Homebridge package.

@pbutler6163
Copy link

I see my issue. The "" if you copy them from above they are in the wrong format.

@FezVrasta
Copy link

I see my issue. The "" if you copy them from above they are in the wrong format.

I suggest to follow the instructions I posted here as they are 100% correct

@tensorcopy
Copy link

@FezVrasta I followed your instruction and now the version is v18. But I start to see Failed to check registry.npmjs.org for updates: "timeout of 10000ms exceeded" - see https://homebridge.io/w/JJSz6 for help. in logs and cannot load the plugin page. Any idea? Thanks!

@RobbieTT
Copy link

RobbieTT commented May 24, 2023

I went around in circles trying to get this to work but no luck following the very helpful instructions above from @FezVrasta. In the end what worked for me was completing the steps shown in this thread and then (and only then) installing Node.js v18 from the Synology Package Center, before finally stoping and restarting Homebridge.

It makes no sense to me why installing the Node.js package last (rather than first) would make a difference but adding this experience in case anyone else was following normal logic and getting nowhere fast, to see if this works for you.

 2023-05-24 at 13 29 56  2023-05-24 at 15 28 10

This is on DSM 7.2-64561 (Release) running on a RS1221+

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 24, 2023
@NorthernMan54
Copy link
Contributor

Not stale

@github-actions github-actions bot removed the stale label Jun 25, 2023
@smathur11
Copy link

FezVrasta's approach worked for me, really helpful. Thanks to everyone on the thread.

@NorthernMan54
Copy link
Contributor

For the people looking to upgrade the nodejs version and other components I have been working thru refreshing the package, and am almost ready to publish it. If you have some time, and want to try out a new version I have the various packages built here.

https://github.com/NorthernMan54/homebridge-syno-spk/releases/tag/3.0.15

If you scroll to the bottom of the page, the various packages are available for each hardware flavour.

Am thinking an update approach would be to make a homebridge UI backup, install the new version, then restore the homebridge UI backup.

PS Please don't do this to your primary instance of Homebridge, in case it breaks things.

@FezVrasta
Copy link

FezVrasta commented Jul 18, 2023

For what it's worth, 18.15.0 is now available through the official Synology package (before it was 18.12) and the instructions posted above allow Node to be upgraded seamlessly.

@RobbieTT
Copy link

@FezVrasta
Yep, the v18.15.0 Syno Package is what I used back in May, as per the screenshot above. It has been working seamlessly since.

☕️

@rh295
Copy link

rh295 commented Jul 18, 2023

After update to 3.0.15 homebridge using again the internal Node.js. Actually v18.16.1

@NorthernMan54
Copy link
Contributor

NorthernMan54 commented Jul 18, 2023

@rh295 Tks for testing this, the NodeJs version v18.16.1 was expected as the refreshed package includes that version. I have now this as 3.0.15.

The release includes:

  • NodeJS v18.16.1 LTS
  • Homebridge v1.6.1
  • Homebridge-config-ui-x v4.50.4

@pasqualito79
Copy link

pasqualito79 commented Jul 19, 2023

Hello, I updated from 3.0.9 to 3.0.15 and now homebridge isn't starting anymore. I guess this is the root cause:

/var/packages/homebridge/target/app/bin$ ./node
-sh: ./node: cannot execute binary file: Exec format error

could it be that an incompatible binary was installed?

My DSM is 7.1.1 on DS415play

as a workaround, I use the node.js from Synology.

@NorthernMan54
Copy link
Contributor

The changes suggested here are included with the release 3.0.17

@devinreams
Copy link

The changes suggested here are included with the release 3.0.17

Thanks @NorthernMan54 and FWIW I just did a "manual install" of 3.0.17 and it worked great, including getting your homebridge-tcc back up and running for me: NorthernMan54/homebridge-tcc#134

@RobbieTT
Copy link

When I updated to Homebridge v3.0.17 I was still left with node.js v18.15.0 rather than the more recent v18.16.1 LTS.

Not sure why.

☕️

@devinreams
Copy link

devinreams commented Jul 24, 2023

When I updated to Homebridge v3.0.17 I was still left with node.js v18.15.0 rather than the more recent v18.16.1 LTS.

If I understand correctly, the official Node.js v18 Synology package is simply a dependency so it may be a while before anyone goes past v18.15...

@NorthernMan54
Copy link
Contributor

@RobbieTT @devinreams When we based the package off of NodeJS 18.16.1 we found that people with older DSM releases had issues due to missing LIBC libraries needed by that version of NodeJS.

To resolve the issue we switched to the Synology supplied NodeJS 18.15. So for the near future we are dependent on Synology updating the NodeJS package.

@RobbieTT
Copy link

@NorthernMan54 Thanks for the explanation, very helpful; you are a gentleman. 👍

☕️

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@primovist
Copy link
Author

Synology has released Nodejs_v20, which can be upgraded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests