OpenWonderLabs / homebridge-switchbot

The Homebridge SwitchBot plugin allows you to access your SwitchBot Device(s) from HomeKit. Homebridge.
https://openwonderlabs.github.io/homebridge-switchbot/
ISC License
246 stars 54 forks source link

Bug: Rename directory not possible on update #1035

Closed kylewhirl closed 1 month ago

kylewhirl commented 2 months ago

Describe the Bug

I get an error when trying to install a new version of the plugin. It gets to rename a directory but can’t since the directory is full. I know how to fix it, but this is not the first time this has happened

To Reproduce

Install v3.1.3 of SwitchBot plugin Install v3.7.0 of SwitchBot plugin

Expected Behavior

The directory should not be renamed, especially not hidden either

Relevant Log Output

npm
 ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR!
 path /usr/local/lib/node_modules/@switchbot/homebridge-switchbot
npm ERR! dest /usr/local/lib/node_modules/@switchbot/.homebridge-switchbot-UUyzm0HE
npm ERR! errno -39
npm
ERR! ENOTEMPTY: directory not empty, rename '/usr/local/lib/node_modules/@switchbot/homebridge-switchbot' -> '/usr/local/lib/node_modules/@switchbot/.homebridge-switchbot-UUyzm0HE'
npm ERR!
 A complete log of this run can be found in: /home/pi/.npm/_logs/2024-08-29T18_13_11_428Z-debug-0.log

Operation failed with code 217.

You can download this log file for future reference.

See https://github.com/homebridge/homebridge-config-ui-x/wiki/Troubleshooting for help.

Config for homebridge-switchbot

This is not needed

Screenshots

No response

Device and Model

Not needed

Node.js Version

v20.11.1

NPM Version

vI.D.K

Homebridge Version

v1.8.4

Homebridge Switchbot Plugin Version

v3.7.0

Homebridge Config UI X Plugin Version

v4.41.2

Operating System

Raspbian

donavanbecker commented 2 months ago

this is a permissions issue.

kylewhirl commented 2 months ago

How do I fix it without having to copy the code the plugin is trying to execute with sudo?

donavanbecker commented 2 months ago

Try:

sudo nom install -g --unsafe-perm @switchbot/homebridge-switchbot
kylewhirl commented 1 month ago

Try:

sudo npm install -g --unsafe-perm @switchbot/homebridge-switchbot

Still same issue with the same error, directory is not empty

kylewhirl commented 1 month ago

This is still not fixed. Every time I update the plugin I have to many go in and sudo rm -rf the Switchbot folder in node modules. Is there a need to rename the directory on every update?

donavanbecker commented 1 month ago

This isn't something that the plugin is doing, this must be part of the npm install process. What I have seen in most cases is that this is a permissions issue.

kylewhirl commented 1 month ago

How can I fix this then? I’ve never had this issue with other plugins, I even did a fresh install of Homebridge on an entirely new machine and I still have this issue, only with this plugin

donavanbecker commented 1 month ago

I have never had the issue, sorry.

donavanbecker commented 1 month ago

Closing all issues now that v4.0.0 is out. If you are still having an issue after trying v4.0.0, please open a new issue. Keep in mind v4.0.0 has some breaking changes with the config. You will need to re set your config up, however there are some nice added bonuses since you can set settings at a deviceType level or individual level.