When creating a docker image using FROM node:buster and running the following:
./node_modules/.bin/moleculer-runner --instances=$INSTANCE_CNT -H -c ./config.js --env services/**
I'm getting the following error:
[Runner] The feature watch recursively is unavailable on the current platform, which is being used to run Node.js TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
at Object.watch (fs.js:1470:11)
at /usr/src/cute/node_modules/moleculer/src/middlewares/hot-reload.js:281:19
at Array.forEach (<anonymous>)
at watchProjectFolders (/usr/src/cute/node_modules/moleculer/src/middlewares/hot-reload.js:276:13)
at ServiceBroker.started (/usr/src/cute/node_modules/moleculer/src/middlewares/hot-reload.js:330:4)
at /usr/src/cute/node_modules/moleculer/src/middleware.js:83:50
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
code: 'ERR_FEATURE_UNAVAILABLE_ON_PLATFORM'
}
The hot reload feature works properly when using the current version of node-lts (FROM node:lts-buster).
Version Used: Moleculer v0.14.10
Thank you :)
Ref: https://github.com/nodejs/node/pull/29947
Ref docs: https://nodejs.org/api/fs.html#fs_caveats
researched the problem, other projects started using the chokidar library to support cross-platform:
https://github.com/molant/cli/commit/71f4a0ac407aea524f19f13de794757d88f3d838
Thanks @intech the investigation. My problem with chokidar that I want to minimalize the number of dependencies in the Moleculer core, so I don't like to add a new lib for hot-reload. Any native alternative solution?
@icebob I fully support your opinion on dependencies.
I have looked into several solutions and my vote for a respected developer https://github.com/mafintosh/recursive-watch
Examples:
https://github.com/gavoja/simple-watcher (maybe leaks)
https://github.com/gmasmejean/watch-recursivly (legacy, high risk leaks)
https://github.com/kbscript/watch-dog (legacy, not interesting)
other very old legacy or many dependencies...
Great, it looks very lightweight with one additional dependencies. Thanks, I will check it.
Any update on this?
@icebob
Have you decided how to move forward with this?
Node v14 is now Active LTS, and v12 has been moved to Maintenance LTS status (as of 2020-11-30). I had to change my Dockerfile to specify FROM node:erbium-buster to keep using moleculer-runner in its current form.
I would be willing to make a pull request if you know which library you would like to use.
@savearray2 Thanks, I think we should try the recursive-watch.
@icebob
I've completed the initial pull request. Let me know if it's acceptable.
It's my first time contributing, though I use moleculer a lot.
Merged!
Most helpful comment
@icebob
I've completed the initial pull request. Let me know if it's acceptable.
It's my first time contributing, though I use moleculer a lot.