ioBroker / ioBroker.javascript

Script engine for JavaScript and Blockly
MIT License
320 stars 119 forks source link

[Bug]: Dependencies installed from GitHub repo need now to be required by their URLs instead of module names (js-controller v6) #1611

Closed Black-Thunder closed 2 weeks ago

Black-Thunder commented 2 weeks ago

I'm sure that

Script type

any

The problem

Follow-up issue to https://github.com/ioBroker/ioBroker.js-controller/issues/2796

Thanks to the quick implementation in js-controller v6 adding custom modules from a GitHub URL now works again. 👍 The only remaining small "issue" is that in scripts you need to require the module by its full URL instead of its module name, as it used to be.

Example:

image

// Does NOT work anymore -> Error: Cannot find module 'node-mihome'
const mihome = require("node-mihome");

// Does work now
const mihome = require("git+https://github.com/Black-Thunder/node-mihome.git");

Probably because of this line where it is stored in "context.mods" by its "depName" instead of its "moduleName": https://github.com/ioBroker/ioBroker.javascript/blob/3330827ddd24c642955d47bda3a50ba2f4f5ae0e/main.js#L1873

Is this the intended behaviour now? If so, maybe this should be added to the docs.

iobroker.current.log (in debug mode!)

No response

Version of nodejs

20.14.0

Version of ioBroker js-controller

6.0.4

Version of adapter

latest GitHub version as of now (commit 3330827)

klein0r commented 2 weeks ago

Is this the intended behaviour now?

No, i'll fix that