Bump ibm-watson dependency
Bump ibm-watson dependency (and its version of axios 1.x) so that node-red-node-watson works on newer versions of Node.js
I ran into a similar "MODULE_NOT_FOUND" as described here https://discourse.nodered.org/t/need-help-with-why-i-cant-install-a-node-node-red-node-watson/82916/3 when I tried to run some of my older Node-RED flows on Node-RED 4.0.5
The Node-RED log reports errors for each of the node-red-node-watson nodes:
[warn] [node-red-node-watson/watson-speech-to-text-v1] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/defaults' is not defined by "exports" in /opt/app-root/data/node_modules/axios/package.json
Even though node-red-node-watson 0.10.3 does not directly have a dependency on axios, the underlying ibm-watson package does. From the node-red-node-watson package.json
"ibm-watson": "^6.2.2",
That ibm-watson version pulls in the older axios "0.26.0" which seems to no longer work with newer versions of Node.js
Fixed by forking https://github.com/watson-developer-cloud/node-red-node-watson
to https://github.com/johnwalicki/node-red-node-watson/
I added one commit (this PR) to bump the ibm-watson dependency
Bump ibm-watson to ^9.1.0
which pulls in axios 1.7.* and now all of the node-red-node-watson nodes work on Node.js 20
How did I test it: Node-RED 4.0.5 running in a container, with my flow with a package.json which points temporarily at my branch
"node-red-node-watson": "github:johnwalicki/node-red-node-watson.git#bump-ibm-watson"
I tested this patched node-red-node-watson with the newer ibm-watson 9.1.0 successfully on Node.js v16, v18, v20
I did not bump any other dependencies.
@chughts For your consideration and review.
This discourse conversation was also a clue. https://discourse.nodered.org/t/stuck-with-text-to-speech-watson-node/81211
The rabbit hole was deep as I tried to determine why axios versions were affecting node-red-node-watson (which doesn't have a direct dependency on axios) https://github.com/axios/axios/issues/5072
The final clue was a comment here https://stackoverflow.com/questions/75642251/using-require-axios-and-vrchat-i-get-error-err-package-path-not-exported-pa which said:
This error usually occurs when there is a mismatch between the version of the axios package and the version of Node.js being used.
Thanks @johnwalicki I'll publish to npm in the next few hours.
or at least after the merge runs, and I can bump the version.
@jjasghar @ibm-reaper could you please either:
Fix the codify/pr dependency on this repository, so it is triggered and reported correctly
or
Grant me admin access to this repository, so I can accept this pull request.
Thanks @chughts for the review.
FWIW - the ibm-watson axios dependency was bumped in ibm-cloud-sdk-core a few months ago.
@mseul-ibm I would like to accept this pull-request, bump the version and publish to npm, but I am prevented by a broken codacy dependency. Could you please fix this, or give me admin access so that I can.
@johnwalicki published to npm as 0.10.4 though had to fork to https://github.com/ibm-early-programs/node-red-node-watson to do so.
Please close this pull request. I will open a new one, with the bump / version change, though it is looking likely that I may need to find a new permanent home for this repository.
Thanks @chughts - The new release looks good.