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

[Bug]: Additional NPM modules aren't loaded/working after each adapter update #1521

Open
3 tasks done
CC1337 opened this issue Mar 18, 2024 · 5 comments
Open
3 tasks done

Comments

@CC1337
Copy link

CC1337 commented Mar 18, 2024

I'm sure that

  • This issue is still present in the current beta version of this adapter
  • There is no other (open) issue with the same topic (use the search!)
  • This issue is not described in the adapter documentation / FAQ (read the docs!)

Script type

Blockly, Javascript

The problem

I configured additional "NPM Module" in instances, named "simple-ssh" After a JS adapter update it is almost NOT working, I can see these entries in logs (truncated a bit):

javascript.0 | 2024-03-18 11:53:23.334 | error | script.js.common.MYSCRIPT: SSH is not a constructor
javascript.0 | 2024-03-18 11:53:23.334 | error | at Immediate._onImmediate (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/adapter.js:8489:62)
javascript.0 | 2024-03-18 11:53:23.334 | error | at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:641:29)
javascript.0 | 2024-03-18 11:53:23.334 | error | at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1390:38)
javascript.0 | 2024-03-18 11:53:23.334 | error | at Object.<anonymous> (script.js.common.1.MYSCRIPT:25:9)
javascript.0 | 2024-03-18 11:53:23.334 | error | at setSwitchPort1PoE (script.js.common.1.MYSCRIPT:5:15)
javascript.0 | 2024-03-18 11:53:23.334 | error | at require (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:528:32)
javascript.0 | 2024-03-18 11:53:23.334 | error | at require (node:internal/modules/cjs/helpers:121:18)
javascript.0 | 2024-03-18 11:53:23.333 | error | at Module.require (node:internal/modules/cjs/loader:1143:19)
javascript.0 | 2024-03-18 11:53:23.333 | error | script.js.common.1.MYSCRIPT: Error: Cannot find module 'simple-ssh'

The usage is inside blockly having a JS function
var SSH = require('simple-ssh');

A workaround is to REMOVE the NPM module, save and restart javascript adapter, and then add it again.
grafik

But if you forget it after update, scripts will just fail :(

I just verified it still happening with Adapter v7.9.1

iobroker.current.log (in debug mode!)

No response

Version of nodejs

v18.17.1

Version of ioBroker js-controller

5.0.19

Version of adapter

7.9.1

@klein0r
Copy link
Collaborator

klein0r commented Mar 18, 2024

And this wasn't the case in previous versions/upgrades? The "additional packages" behaviour wasn't changed in the adapter since several month/years.

@CC1337
Copy link
Author

CC1337 commented Mar 18, 2024

Hey Matthias, the issue persists since I am using it (maybe a year), so it might be since years.
Viele Grüße,
Tibor

@mcm1957
Copy link
Contributor

mcm1957 commented Mar 18, 2024

Just as a link:
https://forum.iobroker.net/topic/73531/adapter-update-f%C3%BChrt-zu-neukompilieren-des-npm-moduls

Seems that any installation kicks additional npm modules. Don't know wether this realted in any way but I want to note it.

@klein0r
Copy link
Collaborator

klein0r commented Mar 19, 2024

@klein0r klein0r added the fixed label May 3, 2024
@klein0r
Copy link
Collaborator

klein0r commented May 3, 2024

see #1554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants