Skip to content

[enhancement]: Allow reinstall of adapter if io-packags.json is corrupt #3017

Open
@mcm1957

Description

@mcm1957

No existing issues.

  • There is no existing issue for my request.

Description

At froum a user reposrted that he cannot install / upgrade backitup. The reason was a broken io-package.json. He got the following messeg every time he wanted to install the adapter::

host.vm-iobroker02 install adapter backitup
host.vm-iobroker02 error: reading io-package.json /opt/iobroker/node_modules/iobroker.backitup/io-package.json: Unexpected end of JSON input
thorsten@vm-iobroker02:/opt/iobroker$

Related forum topic: https://forum.iobroker.net/topic/79683/backup-l%C3%A4sst-sich-nicht-installieren

The problem is that during an installation request iob tries to detect the currently installed version. As reading i-package.json fails (dur to corrupt file) the installation process aborts. It looks lie even a deinstallation does not really work (but I did not verify this).

I would suggest to adapt th sinstallation code in such a way that every time io-package.json (and eventually other critical files) cannot be read the install command should behave just like it does when performing a reinstallation. (npm deinstall followed be npm install). This would fix such cases and is the expected behavior for a user trying to (re-)install anyway.

Note: As the reinstallation code already dies a removal of the npm / code parts followed by a reinstalltion this fixing would save the current paramater settings and thus have benfits above a iob remove followed by a manual deletion of the node_modules tree too

Why?

User would expect thet the system will try to fix fixable erros when perforing a ne installation / reinstallation attempt

How?

see above

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions