I get the following message:

It seems like a timeout of 10 seconds is set, which is WAYYYY too short for npm, especially on low power devices like Raspberry PIs (I suggest using a timeout of 120 seconds). https://github.com/Ylianst/MeshCentral/blob/338e8eb99e2e027a70bb9843bf9149d4f4872a01/meshcentral.js#L1956
Additionally, MeshCentral doesn't seem to care about the fact that I manually installed the specified version already. (Seems to be buggy because of usage of @ in the package name indicating the version. Works fine for other packages.)
The error is because MeshCentral can't call NPM to install the missing GreenLock module. Just do it manually using "npm install [email protected]". There is no 10 second timeout since MeshCentral just can't call NPM at all. Also, what version of node are you using? type "node -v". Thanks.
I have reasonable evidence that you're mistaken. Raising the timeout makes it successfully install the above mentioned NPM package. The 10 second timeout is clearly shown in the GitHub link in my original post. I suggest that you raise it to 120 seconds because npm is agonizingly slow.
I've also stated that manually installing the package does not work because meshcentral fails to detect the installed npm package. I'm speculating that this is caused by the version tag that is supplied since https://github.com/Ylianst/MeshCentral/commit/338e8eb99e2e027a70bb9843bf9149d4f4872a01
Even after the automatic install is finished, meshcentral will perform the install of Greenlock again (twice per start), even tho it was just installed.
Ok... your 100% right. Looking at the code, there was a 10 second time, I just published MeshCentral v0.4.3-v with the timer changed to 120 seconds. I am currently in Australia on vacation and don't have great connectivity. In any case, let me know what version of node you are using, I need to figure out why its detecting that GreenLock is not present.
Thanks! If I have time I may look at the code and try to make a pull request. I'm currently busy but I'll let you know about the node version later (default debian buster (raspbian) node version)
Update: I may take a look at it tomorrow. Ran out of time.
@Ylianst is require('[email protected]') supposed to work? That's what gets called in InstallModules on line var xxmodule = require(modules[i]); in meshcentral.js.
Which throws an error on node v8.10.0, v10.16.3 and v13.0.1 for me - greenlock 2.8.8 installed manually, obviously. Trying require('greenlook') w/o the "@2.8.8" succeds.
v13.0.1 tested with Docker:
## fails on require([email protected])
docker run node:latest sh -c 'node -v && npm install [email protected] && node -e "require(\"[email protected]\");" ; echo $?'
## succeeds
docker run node:latest sh -c 'node -v && npm install [email protected] && node -e "require(\"greenlock\");" ; echo $?'
Oh! Of course it can't work, you can't require with the version number (doh!). I am working on a fix now.
Published MeshCentral v0.4.3-w with a fix for the [email protected] install problem. Should work fine now.
Seems to be fine: Fresh install npm install meshcentral includes [email protected] as dependency (because of package.json), running meshcentral installs 'optlib' - otherwise all fine.
To trigger the added logic in meshcentral.js: after npm uninstall greenlock, starting meshcentral installs greenlock (only on first start as intended) - and runs thereafter.
Thank you.
@Ylianst This looks like a hack to me: https://github.com/Ylianst/MeshCentral/commit/013fb09d6c923b04d110e49be209489bd08a8082#diff-19ac91b23d8fa2004aec991edabbb4c1R1953
Have you considered removing the version tag while requiring the module or allowing the modules array to contain objects as well (you could then have .name and .version)?
Also, I don't think adding greenlock to package.json is necessarily a good idea, since most users will most likely not use greenlock. The NPM install way should be sufficient _in my opinion_.