Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement]: improve reinstall of existing adapter release #2667

Closed
1 task done
mcm1957 opened this issue Apr 5, 2024 · 4 comments · Fixed by #2680
Closed
1 task done

[enhancement]: improve reinstall of existing adapter release #2667

mcm1957 opened this issue Apr 5, 2024 · 4 comments · Fixed by #2680
Assignees

Comments

@mcm1957
Copy link
Contributor

mcm1957 commented Apr 5, 2024

No existing issues.

  • There is no existing issue for my request.

Description

Reinstalling an adapter (install the existing release once more) is possible using
iob upgrade adapter@version

In this case iob asks

pi@pi4:/opt/iobroker/node_modules $ iob upgrade tuya@3.15.0
Would you like to reinstall version 3.15.0 of tuya now? [(y)es, (n)o]:

When selecting yes, a reinstallation seems to occure. BUT this is no real reinstallation, npm does not install files from adapter again, any changes performed at the adpter files will not be overridden and reset to the state of the official pacakge.

So either:
try a TRUE reinstall - files from package should be installed and local modification removed
OR
give a clear indication, that the reinstall will not do what expected

Why?

When executing something name "reinstall" one would expect that this does a reset except local configuration data.

How?

I think it should be possible to to do npm uninstall followed by a normal npm install to do the trick and to cleanup the files provided by the adapter. ioBroker configuration and data files should not be effected by npm.

@foxriver76
Copy link
Collaborator

Upgrade always performs a npm install and reinstall is just the term used if it is detected that the version to install is the already installed one. I don’t see the use case for this delete stuff.

@mcm1957
Copy link
Contributor Author

mcm1957 commented Apr 5, 2024

The use case is that any change to files of the adapter should be reverted to the version deliverd with the version.

npm install of the installed version is simply a nop, it does NOT replace the files installed.

Example:
Edit main.js of adapter and add some this.log.info('hello world');
reinstall the adapter version
Main.js still contains the debug log while I (and most likely many user) would expect the the main.js is again the file provided by the release at npmjs.

This is no ioBroker failure, npm simply "optimizes". Searching for reinstalling an installed package suggests to du uninstall followed by new install. There seems to be no qualifier to force npm to do a real refresh (/ replace.

Note:
Deinstall / Install using iob commands would delete the config / states - so this is no alternative. Using native npm commands would do the trick but should be avoided as they are a little bit risky (default dir, username, ...).

@Apollon77
Copy link
Collaborator

We could try if https://stackoverflow.com/a/43974600 works ... so using "npm install --force"

@mcm1957
Copy link
Contributor Author

mcm1957 commented Apr 7, 2024

We could try if https://stackoverflow.com/a/43974600 works ... so using "npm install --force"

I do not find the articel now, but I read that --force is strongly discouraged to force a reinstallation as --force ignors ANY problems and will install the pacakge even if there are incompatibilities otherwise detected by npm. So in my oppinion --force must be investigataed in detail before considered as a solution,

@foxriver76 foxriver76 self-assigned this Apr 15, 2024
foxriver76 added a commit that referenced this issue Apr 16, 2024
foxriver76 added a commit that referenced this issue Apr 23, 2024
* for reinstall remove the package manually first

- closes #2667

* started working on the big ESM problem

* allow to set debug for uninstall too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants