eWeLink Sonoff Add-on fails to install after removal following powercut

Hi all
I’m hoping someone can help me solve a very frustrating problem with the eWeLink (coolkit) add-on for my SONOFF devices.
Everything had been working great all year until we had a power cut. On restart of my Pi 4b the ewlink add-on would not start. Committed all HA updates but no joy. Devices all work fine from the eWeLink app. In the end I uninstalled the add-on and that’s where I have come unstuck.
When I try and re-install the add on, HA just tries for a while before showing the following error:

Failed to to call /addons/f4f71350_ewelink_smart_home_slug/install - The command ‘/bin/sh -c npm install --production --save-exact’ returned a non-zero code: 1

I am about to start an HA install from scratch with a new SD card for the Pi, but perhaps someone has seen this error before and has a fix? I am not familier with linux, so I don’t have command/shell knowledge unfortunately. I’m limited to the UI.

Latest version of HA running on a Rasperry Pi 4B

Thanks in advance

Better alternative is to use sonoff lan

After removing addons or integrations do you restart or reboot your pi? this helps to clean up things.

Hi
Yes. Many reboots, restarts and updates
Thanks

Clean the npm cache folder.

From CLI:

sudo npm cache clean --force

To verify that the cache has been successfully cleaned:

sudo npm cache verify

Reboot the host and re-install the Add-on again.

Hi Tamsy
Using the SSH Adon, sudo works but I just get “sudo: npm: command not found”
No joy at all using the CLI direcylyu off the Pi

image

You are on Home Assistant OS, obviously. Hence the SSH add-on is a Docker container and when you login through SSH you are inside that container with some limited commands and little way to break out of that container to access the parent host itself (where NodeJS/NPM resides).

There are ways to access the host system but one needs advanced knowledge of Linux and Docker to do so (Home Assistant OS is build on Alpine Linux) and it would go far beyond the scope of this thread to explain this here.

Furthermore I am not 100% sure whether the culprit of the issue is really a fragmented npm cache (although it looks very much to me like it is).

I’m sorry to leave you at this point. Best is to do some more research on the issue by yourself.

However, if you decide to

please don’t forget to make a full backup of your system and store it outside of your RPI to be able to restore it easily after you reinstalled Home Assistant OS :wink:

Also as Francis has already pointed it out further up this thread I would give up on the eWeLink Sonoff Add-on and use AlexxIT’s SonoffLAN instead. It is a matured piece of software and works pretty well :+1:t3: