rse / node-red-contrib-functionx

Clone of the Node-RED function node with capability to automatically install used NPM packages
http://npmjs.com/node-red-contrib-functionx
Apache License 2.0
0 stars 0 forks source link

Node not working anymore under Node-RED 2.0.5 #4

Open ahue opened 3 years ago

ahue commented 3 years ago

Node raises following warning on deploy and is stuck with "installing packages" or as soon as you inject with "waiting for passages" status text on the node.

[info] Started modified nodes
(node:720) UnhandledPromiseRejectionWarning: TypeError: must call as: npm.load(callback)
    at load (/usr/lib/node_modules/npm/lib/npm.js:127:13)
    at internal/util.js:308:30
    at new Promise (<anonymous>)
    at load (internal/util.js:307:12)
    at process.<anonymous> (/config/node-red/node_modules/npm-install-to/lib/npm-install-child.js:7:11)
    at process.emit (events.js:400:28)
    at emit (internal/child_process.js:910:12)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:720) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:720) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Happy to help with this, just not sure where to start.

Hint to anyone stumbeling upon this; The 2.x function node now provides loading of packages, so functionx node is less relevant. It may still be if you require different versions of a package in different nodes since it installs them on demand only.

hlovdal commented 1 year ago

The 2.x function node now provides loading of packages

For details see functionGlobalContext at https://nodered.org/docs/user-guide/writing-functions.