greiginsydney / Homebridge-cbus-installer

An install script that automates the process
GNU General Public License v3.0
8 stars 4 forks source link

Missing NPM #22

Closed jensenoz closed 5 months ago

jensenoz commented 2 years ago

When running the following command:

sudo -E -H ./setup.sh step1

An error message pops up saying that the NPM package is not installed. It references line 43 and if install NPM and re-run the command it works fine.

greiginsydney commented 2 years ago

Hi Jensen(?),

Have you built your Pi from the Homebridge Raspbian Image, as NPM should have been pre-installed.

It's mentioned in Step 1 in the setup.md pre-req's.

- G.

jensenoz commented 2 years ago

Hi Greig,

Did indeed. I installed the Homebridge product from the imaging software. It looks like an update has just been applied.

Screen Shot 2022-06-15 at 12 38 26 pm

The odd thing is that I had to also manually install the Homebridge CUBS plugin and I'm also getting this message when running the step 2 command.

Assuming project name = JACKT, and setting C-Gate project.start & project.default values accordingly. '/usr/local/bin/cgate/tag\JACKT.xml' -> '/usr/local/bin/cgate/tag/JACKT.xml' Skipped: already in config.json Warning: Stopping homebridge.service, but it can still be activated by: homebridge.timer Exited step 2 OK.

Hope that helps.

jensenoz commented 2 years ago

I should say I'm building this on a different network to where my CBUS CNI is based (do some work in the office and home is where the CBUS network is). I don't know if that matters to the beautiful product you created.

Regards,

John Jensen

jensenoz commented 2 years ago

If it helps I've formated by sd card and re-run the process. Here is the actual error message.

pi@homebridge:~ $ sudo -E -H ./setup.sh step1

download jq: Reading package lists... Done Building dependency tree... Done Reading state information... Done jq is already the newest version (1.6-2.1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

download homebridge-cbus: ./setup.sh: line 43: npm: command not found

greiginsydney commented 2 years ago

The odd thing is that I had to also manually install the Homebridge CUBS plugin ...

That's to be expected as NPM was meant to have installed it.

I wonder if this is your issue: https://www.reddit.com/r/homebridge/comments/o0eicr/suddenly_getting_npm_not_found_on_homebridge_via/

sudo apt-get update && apt-get upgrade was this person's fix.


- G.

jensenoz commented 2 years ago

Hi Greig,

My thanks for the suggestion.

I tried your suggested command:

sudo apt-get update && apt-get upgrade

and got the following response.

**_pi@homebridge:~ $ sudo apt-get update && apt-get upgrade Get:1 https://repo.homebridge.io stable InRelease [3,242 B] Get:2 http://archive.raspberrypi.org/debian bullseye InRelease [23.7 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB]
Get:4 https://repo.homebridge.io stable/main armhf Packages [570 B]
Get:5 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [279 kB] Get:6 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages [13.2 MB] Fetched 13.5 MB in 19s (708 kB/s)
Reading package lists... Done E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Next, I look at the provided command and assumed what you meant was the following (found at step 20 in your doco):

sudo apt-get update && sudo apt-get upgrade -y

I had success with the above command.

Lastly, I continued on with steps 21 to 25 but got the same error message again.

**_pi@homebridge:~ $ sudo -E -H ./setup.sh step1

download jq: Reading package lists... Done Building dependency tree... Done Reading state information... Done jq is already the newest version (1.6-2.1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

download homebridge-cbus: ./setup.sh: line 43: npm: command not found_**

To be completely transparent I'm running the above testing on a raspberry pi 4

Regards,

John Jensen

DarylMc commented 2 years ago

@greiginsydney I will run an install tomorrow and have a look.

DarylMc commented 2 years ago

Hi @greiginsydney @jensenoz I struck the same problem with NPM and Node not appearing to be installed using the latest image on github and also direct from raspberry pi imager.

DarylMc commented 2 years ago

Hello @greiginsydney @jensenoz From this link https://github.com/homebridge/homebridge-raspbian-image/issues/87#issuecomment-1175079866

"They are included as part of the Homebridge APT package for exclusive use by homebridge. If you need Node/NPM for other things, you can install then whatever way you like, it won't impact the Homebridge installation.

If you want to access the homebridge node environment via SSH, run sudo hb-shell and it will drop you into it."

DarylMc commented 2 years ago

There is a few changes to raspberry pi OS and Homebridge which will need a little attention in the instructions. The default “pi” user is being removed https://www.raspberrypi.com/news/raspberry-pi-bullseye-update-april-2022/ pi user and password can be added with raspberry pi imager tool before image is written to sd.

DarylMc commented 2 years ago

@greiginsydney In raspberry pi imager select Homebridge image. In advanced settings, setup user pi and a password. Set hostname now is not a bad idea eg "homebridge" I wouldn't do any other settings here especially not wifi. Write image to SD.

After first boot SSH to pi. Update and reboot. sudo apt update && sudo apt upgrade -y sudo reboot Enable "Wait For Network At Boot" sudo raspi-config nonint do_boot_wait 0 Install homebridge-cbus Enter hb shell sudo hb-shell sudo hb-service add homebridge-cbus Exit hb shell exit Transfer xml to /home/pi Install subversion sudo apt install subversion -y Download Greig's script svn export https://github.com/DarylMc/Homebridge-cbus-installer/trunk/code/ ~ --force sudo chmod +x setup.sh sudo -E -H ./setup.sh step1

After the reboot take a break for 5-10 minutes. Run the next script sudo -E ./setup.sh copy

jensenoz commented 2 years ago

A huge thanks @DarylMc for all the work and @greiginsydney for managing the ticket. For less than techie people like myself, I'm bloody grateful. I have access to a CNI-based CBUS network and multiple SD cards with a spare pi that I'm happy to run a test client against when it's ready to go. One question that I do have @DarylMc whilst you are here. ;) Do you know if a very vanilla Homebridge install with the homebridge-cbus addon instead of all of the above is needed if you have a CBUS 5500AC2? https://www.se.com/ww/en/product/5500AC2/application-controller-spacelogic-cbus-rs232-485-ethernet-din-mount-24v-dc/

DarylMc commented 2 years ago

I am not familiar with the device but I believe you would also use one of the built in CNI and connect via TCP like a regular CNI. So then yes you need all the setup as per Greig's instructions.

jensenoz commented 2 years ago

Damn. Ahh well, I thought I would ask. LOL!!! The 5500AC2 is an upgrade to the 5500SHAC (https://www.se.com/ww/en/product/5500SHAC/wiser-for-cbus-automation-controller-rs232-485-ethernet-din-mount-24v-dc/) and I hoped it was more than just a combo USB, RS232 and RJ45 with a web server box. I remember the days when each of those devices were I THINK $500 ish each. OUCH!!! I get the 5500SHAC had more than that as well but again I hoped the CNI concept had been replaced. I still dream of a day when they will finally support Homekit. :) One can hope but then not even Wiser does yet. :(

DarylMc commented 2 years ago

The SHAC can do some things a lot better than Homebridge and HomeKit.

DarylMc commented 2 years ago

https://github.com/greiginsydney/Homebridge-cbus-installer/issues/22#issuecomment-1175601119

@greiginsydney I think this will work but I don't have a CBus network to test at the moment. After first boot SSH to pi, update and reboot. sudo apt update && sudo apt upgrade -y && sudo reboot Install homebridge-cbus Enter hb shell sudo hb-shell sudo hb-service add homebridge-cbus Exit hb shell exit Transfer xml to /home/pi Install subversion sudo apt install subversion -y Download Greig's script svn export https://github.com/greiginsydney/Homebridge-cbus-installer/trunk/code/ ~ --force Delete homebridge-cbus installation lines 41-44 in setup.sh sudo nano setup.sh

echo "" echo ">> download homebridge-cbus:" npm install -g homebridge-cbus echo "======================================="

Save changes to setup.sh ctrl x y enter sudo chmod +x setup.sh sudo -E -H ./setup.sh step1

I setup a small CBus network and tested this method today. Seems OK

DarylMc commented 2 years ago

@greiginsydney @jensenoz I edited the comment above to assist setting up with the latest image. https://github.com/greiginsydney/Homebridge-cbus-installer/issues/22#issuecomment-1175601119

DarylMc commented 1 year ago

@jensenoz Thanks for your help. This issue has been addressed by the following updates and can be closed. https://github.com/greiginsydney/Homebridge-cbus-installer/pull/26 https://github.com/greiginsydney/Homebridge-cbus-installer/pull/24

Maccacca commented 5 months ago

Hello Greig, I have been using this plugin for a while now and it's awesome!!!

Yesterday I was redoing Homebridge on a new pi and Greig's script seems to have disappeared?

svn export https://github.com/DarylMc/Homebridge-cbus-installer/trunk/code/ ~ --force

DarylMc commented 5 months ago

Hello Greig,

I have been using this plugin for a while now and it's awesome!!!

Yesterday I was redoing Homebridge on a new pi and Greig's script seems to have disappeared?

svn export https://github.com/DarylMc/Homebridge-cbus-installer/trunk/code/ ~ --force

I think you have my fork in that link. I haven't looked in a while but you should follow Greigs setup info and links.

greiginsydney commented 5 months ago

As per @DarylMc 's comment yesterday @Maccacca , I don't believe you're referencing this (my) repo.

Maccacca commented 5 months ago

As per @DarylMc 's comment yesterday @Maccacca , I don't believe you're referencing this (my) repo.

All sorted, I have just done something stupid at my end. I followed Greigs setup info and it worked perfectly. Thanks!