Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2k
How To Fix Node.js Install Issues On Linux
If you've found yourself with multiple copies of Node.js installed, or need to update Node.js from an old version, these instructions will help you get back to a "standard" setup usinghb-service.
To run modern versions of Node.js you need to by running Ubuntu 16 / Debian Stretch (9) / Raspbian Stretch (9) or later. You can check your OS version by running this command:
cat /etc/os-release | grep VERSIONYou should not proceed with these instructions if you are running an earlier operating system, instead you should upgrade or re-install your operating system with an up-to-date OS.
💡Homebridge also provides aRaspberry Pi Image built on Raspbian Lite with the latest LTS version of Node.js included.
Note down where your Homebridge storage folder is, this is the folder than contains your Homebridgeconfig.json file.
This could be in one of a few locations, some possibilities are:
/home/pi/.homebridge/home/<YOUR USER>/.homebridge/var/homebridge/var/lib/homebridge
You will need to re-install all your Homebridge plugins after completing these steps. Make a note of which plugins you have installed.
The Homebridge service what makes Homebridge automatically start on boot. As part of this change we will change your process supervisor to usehb-service which is backed bysystemd. To do this you will need to remove your existing Homebridge service.
There are several tools you might be using to run Homebridge as a service:
systemd/systemctl/hb-serviceinit.dpm2
If you are usingsystemd orhb-service you can run these commands to remove the service (adjust for your Homebridge service name):
sudo systemctl stop homebridgesudo systemctl disable homebridgesudo rm -rf /etc/systemd/system/homebridge.servicesudo systemctl daemon-reloadIf you are running Homebridge withinit.d you can use these commands to remove the service:
sudo service homebridge stopsudo update-rc.d homebridge removerm -rf /etc/init.d/homebridgeIf you are running Homebridge withpm2 you can use these commands to remove the service:
sudo pm2 stop allsudo pm2 delete allCheck that Homebridge is no longer running before proceeding to the next step.
Runthis script to remove all copies of Node.js, Homebridge, and plugins and other npm modules installed on your system:
sudo curl -fL https://gist.githubusercontent.com/oznu/312b54364616082c3c1e0b6b02351f0e/raw/remove-node.sh | sudo bashYou should now exit your current terminal session and start a fresh one.
If your Homebridge storage folder is not already set to/var/lib/homebridge, you will need to move it to this location to avoid loosing any Homebridge settings.
sudo mkdir -p /var/libsudo cp -R<PATH TO EXISTING HOMEBRIDGE> /var/lib/homebridge## EXAMPLES ONLY - RUN ONLY THE COMMAND RELEVANT TO YOU:sudo cp -R /home/pi/.homebridge /var/lib/homebridgesudo cp -R /home/<YOUR USER>/.homebridge /var/lib/homebridgesudo cp -R /var/homebridge /var/lib/homebridge
You can now safely follow the wiki install guides that explain how to install Node.js and setup Homebridge as a service again. If you have correctly moved your config to/var/lib/homebridge then you won't loose any existing settings.
You can now use the Homebridge UI to re-install any plugins you previously had installed.
The wiki guides will always contain instructions on how to install the latest LTS version of Node.js. When you need to update Node.js again in the future, make sure you refer back to those guides for the correct instructions to avoid having to go through this process again.
- Raspberry Pi
- Debian, Ubuntu
- CentOS, Fedora, Red Hat
- Arch, Manjaro
- Docker
- Virtual Machine ( Windows and MacOS)
- macOS
- Synology DSM 7
- Other Platforms
- Basic Troubleshooting
- Backup and Restore
- Child Bridges
- Config File
- Connect To HomeKit
- FFmpeg for Homebridge
- HomeKit Glossary of Terms
- iOS Homemanager App
- mDNS Options
- Remote Access
- Useful Links
- Basic Troubleshooting
- Config Options
- Enabling Accessory Control
- Enabling UI with Docker
- Homebridge Service Command
- Manual Configuration
- Reverse Proxy: Apache
- Reverse Proxy: Nginx and SSL
- Standalone Mode
- Swap From Standalone To Service Mode
- Developer Docs
- API Reference
- Plugin Templates
- Other Links (Internal)
- Other Links (External)