Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.24k stars 568 forks source link

MeshCentral Service Crashes #450

Closed johnczer closed 12 months ago

johnczer commented 5 years ago

I commented about this on another thread but thought I should put it here because this is related to the NPM install method and the other was more about the installer method. I noticed this on an upgrade and also just tried a brand new install of the latest version; the MeshCentral service crashes it appears from the logs that I have to create this folder manually and copy these files in order for the service to stay running. { Error: Cannot find module 'C:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (C:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (C:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'C:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (C:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (C:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'C:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (C:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (C:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'C:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (C:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (C:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'C:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (C:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (C:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'C:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (C:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (C:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' }

Ylianst commented 5 years ago

So, when posting bug reports, please include how to replicate this problem. What OS and OS version are you using? What NPM commands did you type to get this? Did you using the MeshCentral Installer for Windows?

Any information to get me to replicate this issue would be much appreciated. Thanks.

johnczer commented 5 years ago

Sorry Ylian, This is running on Windows Server 2012 R2 using NPM as follows: cd c:\meshcentral npm install meshcentral cd /node_modules/meshcentral node meshcentral --install This happened after upgrading around version 0.3.9 I believe and I have even tried a new install from scratch. If I go back to let's say 0.3.9-f and upgrade from there this issue happens. The upgrade and even the new install seems to go fine but meshserver service just stops. If I manually create the nodemodules folder at this path: c$\meshcentral\node_modules\meshcentral with minimist, node-windows and ws and contents of these folders the service will stay running and everything works as expected. I gathered this idea from looking at the logs "Error: Cannot find module 'C:\meshcentral\node_modules\meshcentral\node_modules\minimist'". Please let me know what else I can provide or test to help. Thanks

Ylianst commented 5 years ago

Ok, thanks. That is what I needed. Note that you can always rename "node_modules" to another name and do "npm install meshcentral" again, but "npm install" does not install all the modules MeshCentral needs. A workaround may be to run it once manually to let it install the optional modules.

cd c:\meshcentral
npm install meshcentral
node node_modules/meshcentral
(wait, optional modules will install, hit ctrl-c when done)
node node_modules/meshcentral --install
johnczer commented 5 years ago

Ok, so I had a chance to try this and ran all of the above commands as you recommended. This is the first part: c:\meshcentral>npm install meshcentral npm WARN meshcentral No description npm WARN meshcentral No repository field. npm WARN meshcentral No license field.

c:\meshcentral>node node_modules/meshcentral MeshCentral HTTP redirection server running on port 80. MeshCentral v0.4.0-k, Hybrid (LAN + WAN) mode. MeshCentral Intel(R) AMT server running on support.rsa-systems.org:4433. Server _customer1 has no users, next new account will be site administrator. Server info has no users, next new account will be site administrator. MeshCentral HTTPS server running on support.rsa-systems.org:443. SMTP mail server mail.rsa-systems.org working as expected.

Then when I run the last part: c:\meshcentral>node node_modules/meshcentral --install MeshCentral service installed. MeshCentral service started.

The service is there but it still stops continually. Should there be a folder named "node_modules" under this path? C:\meshcentral\node_modules\meshcentral When I create it manually everything works but it gets deleted when I update again.

johnczer commented 5 years ago

Ylianst, have you had a chance to look at this based on me trying your suggestion (node node_modules/meshcentral) and still the same result after each update to meshcentral where the nodemodules folder has to be recreated?

johnczer commented 5 years ago

Ylianst, I was just checking to see if this issue was resolved and I just missed it. I am still having this issue when I update meshcentral and the node_modules folder gets removed which causes the meshcentral server service to stop. I have the following folder structure: C:\meshcentral\node_modules\meshcentral (node_modules folder gets deleted from here) and I am running these commands: cd c:\meshcentral npm install meshcentral node node_modules/meshcentral (wait, optional modules will install, hit ctrl-c when done) node node_modules/meshcentral --install If I copy that folder manually everything works. Just thought I'd see if anyone else is having this issue or is there something else I need to be doing so this one can be closed. Thanks

MailYouLater commented 5 years ago

OK, so you're still experiencing an issue... After reading this whole thread, I'm actually not sure what the actual issue is. Your description is ... a bit nebulous.

Can you possibly answer these questions:. Is this issue occurring even when going through the extra step (described above by Ylianst) of directly running MeshCentral without the service once prior to running it with the --install parameter (to set up the service), or is the issue only occurring when you skip that step? Also, can you post the output of each of the commands, and describe the difference between the expected behavior and what's actually happening?

johnczer commented 5 years ago

I don't see where it was suggested to run MeshCentral without --install. I have been running these npm commands in this order: 1-cd c:\meshcentral 2-npm install meshcentral 3-node node_modules/meshcentral 3b-(wait, optional modules will install, hit ctrl-c when done) 4-node node_modules/meshcentral --install I don't get any errors when going through all of the steps and MeshCentral service starts-initially. When I try to load the portal the service stops. The logs in the very first post gave me a hint as to what was happening. The node_modules folder gets removed after updating each time. If I copy it manually to this path: C:\meshcentral\node_modules\meshcentral with the included folders (minimist, node-windows and ws) the service stays running and everything works. I have to do this each time I upgrade and I have even tried a brand new install.

johnczer commented 5 years ago

Here is the meshcentral.err.log c:\meshcentral\node_modules\node-windows\lib\wrapper.js:177 child.send('shutdown'); ^

TypeError: Cannot read property 'send' of null at process.killkid (c:\meshcentral\node_modules\node-windows\lib\wrapper.js:177:11) at process.emit (events.js:198:13) at process.exit (internal/process/per_thread.js:168:15) at monitor (c:\meshcentral\node_modules\node-windows\lib\wrapper.js:99:17) at ChildProcess. (c:\meshcentral\node_modules\node-windows\lib\wrapper.js:170:5) at ChildProcess.emit (events.js:198:13) at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) c:\meshcentral\node_modules\node-windows\lib\wrapper.js:177 child.send('shutdown'); ^

TypeError: Cannot read property 'send' of null at process.killkid (c:\meshcentral\node_modules\node-windows\lib\wrapper.js:177:11) at process.emit (events.js:198:13) at process.exit (internal/process/per_thread.js:168:15) at monitor (c:\meshcentral\node_modules\node-windows\lib\wrapper.js:99:17) at ChildProcess. (c:\meshcentral\node_modules\node-windows\lib\wrapper.js:170:5) at ChildProcess.emit (events.js:198:13) at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

Here is the meshcentral.out.log: { Error: Cannot find module 'c:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (c:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (c:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'c:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (c:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (c:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'c:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (c:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (c:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'c:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (c:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (c:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'c:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (c:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (c:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' } { Error: Cannot find module 'c:\meshcentral\node_modules\meshcentral\node_modules\minimist' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at start (c:\meshcentral\node_modules\meshcentral\winservice.js:39:22) at Object. (c:\meshcentral\node_modules\meshcentral\winservice.js:76:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' }

johnczer commented 5 years ago

Here is the output of the commands. Even though there are errors I get past these no problem. The server stills dies and won't stay running unless I manually copy the folder as mentioned above from a previous install.

Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved.

C:\Windows\system32>cd c:\meshcentral

c:\meshcentral>npm install meshcentral npm WARN saveError ENOENT: no such file or directory, open 'c:\meshcentral\packa ge.json' npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN enoent ENOENT: no such file or directory, open 'c:\meshcentral\package. json' npm WARN meshcentral No description npm WARN meshcentral No repository field. npm WARN meshcentral No README data npm WARN meshcentral No license field.

c:\meshcentral>node node_modules/meshcentral Installing node-windows... Installing otplib... MeshCentral HTTP redirection server running on port 80. Generating certificates, may take a few minutes... Generating root certificate... Generating HTTPS certificate... Generating MeshAgent certificate... Generating Intel AMT MPS certificate... MeshCentral v0.4.2-u, LAN mode. Server has no users, next new account will be site administrator. MeshCentral HTTPS server running on port 443. Server Ctrl-C exit...

c:\meshcentral>node node_modules/meshcentral --install Installing node-sspi... Installing greenlock... ERROR: Unable to install required module "greenlock". MeshCentral may not have a ccess to npm, or npm may not have suffisent rights to load the new module. Try " npm install greenlock" to manualy install this module.

c:\meshcentral>node node_modules/meshcentral --install Installing le-acme-core... Installing nodemailer... MeshCentral service installed. MeshCentral service started.

c:\meshcentral>npm install greenlock

ursa-optional@0.9.10 install c:\meshcentral\node_modules\ursa-optional node rebuild.js

ursaNative bindings compilation fail. This is not an issue. Modules that depend on it will use fallbacks.

acme-v2@1.8.6 postinstall c:\meshcentral\node_modules\acme-v2 node scripts/postinstall

Greenlock and ACME.js v3 are on the way! Watch for updates at https://indiegogo.com/at/greenlock

npm WARN saveError ENOENT: no such file or directory, open 'c:\meshcentral\packa ge.json' npm WARN enoent ENOENT: no such file or directory, open 'c:\meshcentral\package. json' npm WARN meshcentral No description npm WARN meshcentral No repository field. npm WARN meshcentral No README data npm WARN meshcentral No license field.

c:\meshcentral>node node_modules/meshcentral --install MeshCentral service already installed.

c:\meshcentral>

MailYouLater commented 5 years ago

Thanks. FYI, it's much easier to read code, commands, and command output of you put them in code blocks.

I'd recommend that you bypass all the extra steps of trying to get MeshCentral to install all of the optional modules by including them on the npm install command line. Looking at your command output from above, that would mean the following commands for you:

CD C:\meshcentral
npm install meshcentral node-windows otplib node-sspi greenlock le-acme-core nodemailer
node node_modules\meshcentral --install

As far as the missing npm package(s), after you've installed MeshCentral, but before you copy/move that folder, can you run npm list while you're in the C:\meshcentral folder, and post the results here?

MailYouLater commented 5 years ago

Oh, also:

I don't see where it was suggested to run MeshCentral without --install. I have been running these npm commands in this order: 1-cd c:\meshcentral 2-npm install meshcentral 3-node node_modules/meshcentral 3b-(wait, optional modules will install, hit ctrl-c when done) 4-node node_modules/meshcentral --install I don't get any errors when going through all of the steps and MeshCentral service starts-initially. When I try to load the portal the service stops. The logs in the very first post gave me a hint as to what was happening. The node_modules folder gets removed after updating each time. If I copy it manually to this path: C:\meshcentral\node_modules\meshcentral with the included folders (minimist, node-windows and ws) the service stays running and everything works. I have to do this each time I upgrade and I have even tried a brand new install.

johnczer commented 5 years ago
johnczer commented 5 years ago

+-- binary-search-tree@0.2.5 | -- underscore@1.4.4 +-- body-parser@1.19.0 | +-- bytes@3.1.0 | +-- content-type@1.0.4 | +-- debug@2.6.9 | |-- ms@2.0.0 | +-- depd@1.1.2 | +-- http-errors@1.7.2 | | +-- depd@1.1.2 deduped | | +-- inherits@2.0.3 | | +-- setprototypeof@1.1.1 deduped | | +-- statuses@1.5.0 deduped | | -- toidentifier@1.0.0 | +-- iconv-lite@0.4.24 | |-- safer-buffer@2.1.2 | +-- on-finished@2.3.0 | | -- ee-first@1.1.1 | +-- qs@6.7.0 | +-- raw-body@2.4.0 | | +-- bytes@3.1.0 deduped | | +-- http-errors@1.7.2 deduped | | +-- iconv-lite@0.4.24 deduped | |-- unpipe@1.0.0 | -- type-is@1.6.18 | +-- media-typer@0.3.0 |-- mime-types@2.1.24 deduped +-- cbor@4.1.5 | +-- bignumber.js@8.1.1 deduped | +-- commander@2.20.3 | +-- json-text-sequence@0.1.1 | | -- delimit-stream@0.1.0 |-- nofilter@1.0.3 +-- compressible@2.0.17 | -- mime-db@1.40.0 +-- compression@1.7.4 | +-- accepts@1.3.7 deduped | +-- bytes@3.0.0 | +-- compressible@2.0.17 deduped | +-- debug@2.6.9 deduped | +-- on-headers@1.0.2 | +-- safe-buffer@5.1.2 |-- vary@1.1.2 +-- connect-redis@3.4.2 | +-- debug@4.1.1 | | -- ms@2.1.2 |-- redis@2.8.0 | +-- double-ended-queue@2.1.0-0 | +-- redis-commands@1.5.0 | -- redis-parser@2.6.0 +-- content-disposition@0.5.3 |-- safe-buffer@5.1.2 deduped +-- cookie@0.4.0 +-- cookie-session@2.0.0-beta.3 | +-- cookies@0.7.1 | | +-- depd@1.1.2 deduped | | -- keygrip@1.0.3 | +-- debug@3.1.0 | |-- ms@2.0.0 deduped | +-- on-headers@1.0.2 deduped | -- safe-buffer@5.1.1 +-- cookie-signature@1.0.6 +-- define-properties@1.1.3 |-- object-keys@1.1.1 +-- destroy@1.0.4 +-- encodeurl@1.0.2 +-- escape-html@1.0.3 +-- etag@1.8.1 +-- express@4.17.1 | +-- accepts@1.3.7 deduped | +-- array-flatten@1.1.1 deduped | +-- body-parser@1.19.0 deduped | +-- content-disposition@0.5.3 deduped | +-- content-type@1.0.4 deduped | +-- cookie@0.4.0 deduped | +-- cookie-signature@1.0.6 deduped | +-- debug@2.6.9 deduped | +-- depd@1.1.2 deduped | +-- encodeurl@1.0.2 deduped | +-- escape-html@1.0.3 deduped | +-- etag@1.8.1 deduped | +-- finalhandler@1.1.2 | | +-- debug@2.6.9 deduped | | +-- encodeurl@1.0.2 deduped | | +-- escape-html@1.0.3 deduped | | +-- on-finished@2.3.0 deduped | | +-- parseurl@1.3.3 deduped | | +-- statuses@1.5.0 deduped | | -- unpipe@1.0.0 deduped | +-- fresh@0.5.2 | +-- merge-descriptors@1.0.1 | +-- methods@1.1.2 | +-- on-finished@2.3.0 deduped | +-- parseurl@1.3.3 | +-- path-to-regexp@0.1.7 | +-- proxy-addr@2.0.5 | | +-- forwarded@0.1.2 | |-- ipaddr.js@1.9.0 | +-- qs@6.7.0 deduped | +-- range-parser@1.2.1 | +-- safe-buffer@5.1.2 deduped | +-- send@0.17.1 | | +-- debug@2.6.9 deduped | | +-- depd@1.1.2 deduped | | +-- destroy@1.0.4 deduped | | +-- encodeurl@1.0.2 deduped | | +-- escape-html@1.0.3 deduped | | +-- etag@1.8.1 deduped | | +-- fresh@0.5.2 deduped | | +-- http-errors@1.7.2 deduped | | +-- mime@1.6.0 | | +-- ms@2.1.1 | | +-- on-finished@2.3.0 deduped | | +-- range-parser@1.2.1 deduped | | -- statuses@1.5.0 deduped | +-- serve-static@1.14.1 | | +-- encodeurl@1.0.2 deduped | | +-- escape-html@1.0.3 deduped | | +-- parseurl@1.3.3 deduped | |-- send@0.17.1 deduped | +-- setprototypeof@1.1.1 | +-- statuses@1.5.0 | +-- type-is@1.6.18 deduped | +-- utils-merge@1.0.1 | -- vary@1.1.2 deduped +-- express-handlebars@3.1.0 | +-- glob@7.1.4 deduped | +-- graceful-fs@4.2.2 | +-- handlebars@4.4.3 | | +-- neo-async@2.6.1 | | +-- optimist@0.6.1 deduped | | +-- source-map@0.6.1 | |-- uglify-js@3.6.3 | | +-- commander@2.20.3 deduped | | -- source-map@0.6.1 deduped | +-- object.assign@4.1.0 | | +-- define-properties@1.1.3 deduped | | +-- function-bind@1.1.1 | | +-- has-symbols@1.0.0 | |-- object-keys@1.1.1 deduped | -- promise@8.0.3 |-- asap@2.0.6 deduped +-- express-ws@4.0.0 | -- ws@5.2.2 |-- async-limiter@1.0.1 deduped +-- fd-slicer@1.1.0 | -- pend@1.2.0 +-- greenlock@2.8.8 | +-- acme@1.3.5 | |-- acme-v2@1.8.6 deduped | +-- acme-dns-01-cli@3.0.7 | +-- acme-v2@1.8.6 | | +-- @root/request@1.3.11 | | -- rsa-compat@2.0.8 deduped | +-- cert-info@1.5.1 | +-- greenlock-store-fs@3.0.2 | | +-- @root/mkdirp@1.0.0 | |-- safe-replace@1.1.0 | +-- keypairs@1.2.14 | | +-- eckles@1.4.1 | | -- rasha@1.2.5 | +-- le-challenge-fs@2.0.9 | |-- @root/mkdirp@1.0.0 deduped | +-- le-sni-auto@2.1.9 | +-- le-store-certbot@2.2.3 | | +-- @root/mkdirp@1.0.0 deduped | | +-- pyconf@1.1.7 | | | -- safe-replace@1.1.0 deduped | |-- safe-replace@1.1.0 deduped | -- rsa-compat@2.0.8 |-- keypairs@1.2.14 deduped +-- immediate@3.0.6 +-- ipcheck@0.1.0 +-- le-acme-core@2.1.4 | +-- request@2.88.0 | | +-- aws-sign2@0.7.0 | | +-- aws4@1.8.0 | | +-- caseless@0.12.0 | | +-- combined-stream@1.0.8 | | | -- delayed-stream@1.0.0 | | +-- extend@3.0.2 | | +-- forever-agent@0.6.1 | | +-- form-data@2.3.3 | | | +-- asynckit@0.4.0 | | | +-- combined-stream@1.0.8 deduped | | |-- mime-types@2.1.24 deduped | | +-- har-validator@5.1.3 | | | +-- ajv@6.10.2 | | | | +-- fast-deep-equal@2.0.1 | | | | +-- fast-json-stable-stringify@2.0.0 | | | | +-- json-schema-traverse@0.4.1 | | | | -- uri-js@4.2.2 | | | |-- punycode@2.1.1 | | | -- har-schema@2.0.0 | | +-- http-signature@1.2.0 | | | +-- assert-plus@1.0.0 | | | +-- jsprim@1.4.1 | | | | +-- assert-plus@1.0.0 deduped | | | | +-- extsprintf@1.3.0 | | | | +-- json-schema@0.2.3 | | | |-- verror@1.10.0 | | | | +-- assert-plus@1.0.0 deduped | | | | +-- core-util-is@1.0.2 deduped | | | | -- extsprintf@1.3.0 deduped | | |-- sshpk@1.16.1 | | | +-- asn1@0.2.4 | | | | -- safer-buffer@2.1.2 deduped | | | +-- assert-plus@1.0.0 deduped | | | +-- bcrypt-pbkdf@1.0.2 | | | |-- tweetnacl@0.14.5 deduped | | | +-- dashdash@1.14.1 | | | | -- assert-plus@1.0.0 deduped | | | +-- ecc-jsbn@0.1.2 | | | | +-- jsbn@0.1.1 deduped | | | |-- safer-buffer@2.1.2 deduped | | | +-- getpass@0.1.7 | | | | -- assert-plus@1.0.0 deduped | | | +-- jsbn@0.1.1 | | | +-- safer-buffer@2.1.2 deduped | | |-- tweetnacl@0.14.5 | | +-- is-typedarray@1.0.0 | | +-- isstream@0.1.2 | | +-- json-stringify-safe@5.0.1 | | +-- mime-types@2.1.24 deduped | | +-- oauth-sign@0.9.0 | | +-- performance-now@2.1.0 | | +-- qs@6.5.2 | | +-- safe-buffer@5.1.2 deduped | | +-- tough-cookie@2.4.3 | | | +-- psl@1.4.0 | | | -- punycode@1.4.1 | | +-- tunnel-agent@0.6.0 | | |-- safe-buffer@5.1.2 deduped | | -- uuid@3.3.3 |-- rsa-compat@1.9.4 extraneous +-- lie@3.1.1 | -- immediate@3.0.6 deduped +-- localforage@1.7.3 |-- lie@3.1.1 deduped +-- meshcentral@0.4.2-u | +-- archiver@3.1.1 deduped | +-- body-parser@1.19.0 deduped | +-- cbor@4.1.5 deduped | +-- compression@1.7.4 deduped | +-- connect-redis@3.4.2 deduped | +-- cookie-session@2.0.0-beta.3 deduped | +-- express@4.17.1 deduped | +-- express-handlebars@3.1.0 deduped | +-- express-ws@4.0.0 deduped | +-- ipcheck@0.1.0 deduped | +-- meshcentral@0.4.2-u deduped | +-- minimist@1.2.0 | +-- multiparty@4.2.1 | | +-- fd-slicer@1.1.0 deduped | | +-- http-errors@1.7.2 deduped | | +-- safe-buffer@5.1.2 deduped | | -- uid-safe@2.1.5 | |-- random-bytes@1.0.0 | +-- nedb@1.8.0 | | +-- async@0.2.10 | | +-- binary-search-tree@0.2.5 deduped | | +-- localforage@1.7.3 deduped | | +-- mkdirp@0.5.1 | | | -- minimist@0.0.8 | |-- underscore@1.4.4 deduped | +-- node-forge@0.8.5 | +-- node-vault@0.9.11 | | +-- debug@3.1.0 | | | -- ms@2.0.0 deduped | | +-- mustache@2.3.2 | | +-- request@2.88.0 deduped | | +-- request-promise-native@1.0.7 | | | +-- request-promise-core@1.1.2 | | | |-- lodash@4.17.15 deduped | | | +-- stealthy-require@1.1.1 | | | -- tough-cookie@2.4.3 deduped | |-- tv4@1.3.0 | +-- ws@6.2.1 | | -- async-limiter@1.0.1 deduped | +-- xmldom@0.1.27 |-- yauzl@2.10.0 | +-- buffer-crc32@0.2.13 deduped | -- fd-slicer@1.1.0 deduped +-- node-sspi@0.2.5 | +-- bindings@1.5.0 | |-- file-uri-to-path@1.0.0 | -- nan@2.14.0 +-- node-windows@0.1.14 | +-- optimist@0.6.1 | | +-- minimist@0.0.10 | |-- wordwrap@0.0.3 | -- xml@0.0.12 +-- nodemailer@6.3.1 -- otplib@11.0.1 `-- thirty-two@1.0.2

npm ERR! extraneous: rsa-compat@1.9.4 C:\meshcentral\node_modules\le-acme-core\n ode_modules\rsa-compat

C:\meshcentral>

MailYouLater commented 5 years ago

Sorry for the delay, I wrote a reply the other day, but accidentally hit the back button, and it disappeared, so I wasn't feeling very motivated to rewrite it again.

It looks like minimist, node-windows, and ws are all in the right places to me. Did you still have to copy/move things around after using npm to install the optional components from the beginning?

Also, to be a bit more specific about the code blocks, inline code should be 'quoted' in single 'backticks' (e.g. I ran `this command` in that folder), but multi-line code blocks should be placed between two lines that contain three backticks (```) on each of them, so while writing your post, it would look like so:

This is what I got when I ran `DIR /W meshcentral-data`:
```
 Volume in drive C is Windows
 Volume Serial Number is 92AE-5270

 Directory of C:\meshcentral\meshcentral-data

[.]                            [..]
agentserver-cert-private.key   agentserver-cert-public.crt
config.json                    meshcentral-events.db
meshcentral-power.db           meshcentral-smbios.db
meshcentral-stats.db           meshcentral.db
mesherrors.txt                 mpsserver-cert-private.key
mpsserver-cert-public.crt      root-cert-private.key
root-cert-public.crt           serverstate.txt
webserver-cert-private.key     webserver-cert-public.crt
              16 File(s)      1,156,401 bytes
               2 Dir(s)  483,540,668,416 bytes free
```

Also, another tip is that you can easily copy the output of a command to the clipboard on Windows by piping the command to CLIP, so if I'm posting the output from npm list, I would run npm list | CLIP, go to my GitHub reply and type `, `, `, Enter, Ctrl+V, Enter, `, `, `

johnczer commented 5 years ago

No worries at all-I’ve done that before. I’ve never had this issue with those components before the 0.4.x versions. I just noticed that after I upgraded; the service started and all seemed fine until I loaded the site. So if I am the only one having this issue I’ll need to investigate further. I know I haven’t changed my method of install/upgrading, so this is quite strange. I’ll post back if I come up with anything. Thanks for your help!

MailYouLater commented 5 years ago

Did you still have to copy/move things around after using npm to install the optional components from the beginning?

johnczer commented 5 years ago

No, I did not have to copy that node_modules folder with the 3 components (minimist, node-windows, and ws). I also did not have to install the optional components that you saw when I shared my script, i.e. letsencrypt, greenlock, etc., but this is not a big deal. One thing I thought about and I was going to try again was to not use my config.json when I do the new install-just for testing. I may have already tried this but can't remember. I will let you know the results.

johnczer commented 5 years ago

This is the result of a brand new install without using my custom config.json: '''

Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved.

C:\Windows\system32>cd c:\meshcentral

c:\meshcentral>npm install meshcentral npm WARN saveError ENOENT: no such file or directory, open 'c:\meshcentral\packa ge.json' npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN enoent ENOENT: no such file or directory, open 'c:\meshcentral\package. json' npm WARN meshcentral No description npm WARN meshcentral No repository field. npm WARN meshcentral No README data npm WARN meshcentral No license field.

c:\meshcentral>node node_modules/meshcentral Installing node-windows... Installing otplib... MeshCentral HTTP redirection server running on port 80. Generating certificates, may take a few minutes... Generating root certificate... Generating HTTPS certificate... Generating MeshAgent certificate... Generating Intel AMT MPS certificate... MeshCentral v0.4.2-z, LAN mode. Server has no users, next new account will be site administrator. MeshCentral HTTPS server running on port 443. Server Ctrl-C exit...

c:\meshcentral>node node_modules/meshcentral --install MeshCentral service installed. MeshCentral service started.

c:\meshcentral>

'''

Still doing the same thing.

johnczer commented 5 years ago

Ok, so I tried uninstalling everything, this includes npm and node.js and reinstalling-everything. Please note that this is and has always been installed on Windows Server 2012 R2, which was listed as supported OS in Install Guide; at least for the Windows Installation Tool. So...back to the original question: "why all of a sudden is the meshcentral service stopping?" Surely, something can be gleaned from the logs I have provided. I keep going back to the meshcentral.out.log and what is telling the service to look here ({ Error: Cannot find module 'c:\meshcentral\node_modules\meshcentral**node_modules**\minimist') for these components...?

MailYouLater commented 5 years ago

So, just to verify, please let me know if any of this is incorrect: You're trying to run the MeshCentral server is as a service, and after installing the service, it seems to start and operate normally, until you open a web browser and try to connect to it. At this point it crashes, and leaves something in the log about not being able to find minimist. As a workaround to the issue, you create a node_modules folder inside the meshcentral folder, where you place a minimist folder (containing minimist`).

Can you open up C:\Windows\System32\services.msc, open up the properties of the mesh central service, and post a screenshot, as well as copy/pasting the full contents of the "Path to executable:" field?

johnczer commented 5 years ago

Yes, you are mostly correct:

MailYouLater commented 5 years ago

Oh, well that's not what I expected. ... I guess I'll have to actually install it as a service some time to see what it's like.

johnczer commented 5 years ago

When you say “...not what you expected” what do you mean? That’s how I’ve always ran it, so I’m wondering how many others do not run it as a service and that’s why this seems like such a remote issue.

MailYouLater commented 5 years ago

I don't know how others use it, but I'm still primarily testing MeshCentral, and so far I've only run it via a portable version of node from https://github.com/jgonyea/nodejs-portable/releases, which I run, then through the command prompt that opens, I run npm install meshcentral, and node node_modules\meshcentral. To install it as a service, I'd first have to set up a proper install of node, or I'd have to use the MeshCentral installer.

When I said it was "not what I expected" I meant that I wasn't even aware that when installed as a service it gained a 'daemon' folder, which isn't present in my installation.

johnczer commented 5 years ago

I was ready to give up on this but after walking away because of being so busy I revisited today and figured this out. Ylianst is it possible to change the winservice.js //setup libraries section to this:

// Setup libraries const args = require(path.join(cwd, '../minimist'))(process.argv.slice(2)); const nodewindows = require(path.join(cwd, '../node-windows'));

When it is set to node_modules/minimist and node_modules/node_windows it is causing the meshcentral Windows service to crash after upgrading because it is expecting to find another node_modules folder under the meshcentral folder: (i.e. C:\meshcentral\node_modules\meshcentral\node_modules when it should be looking in the existing C:\meshcentral\node_modules for the libraries, specifically node-windows and minimist. With these changes in my winservice.js the Windows service starts and runs perfectly but I know it will get overwritten in future updates. Thanks

MailYouLater commented 4 years ago

@Ylianst: johnczer is recommending the following changes to these lines: https://github.com/Ylianst/MeshCentral/blob/45043b20cd1d36effe9f799407efa087ba6e40a4/winservice.js#L38-L40

        // Setup libraries
-        const args = require(path.join(cwd, 'node_modules/minimist'))(process.argv.slice(2));
+        const args = require(path.join(cwd, '../minimist'))(process.argv.slice(2));
-        const nodewindows = require(path.join(cwd, 'node_modules/node-windows'));
+        const nodewindows = require(path.join(cwd, '../node-windows'));

I'm wondering though, wouldn't it be better to drop the path all together and let require() find these modules automatically? By default it should search through several locations, and I think the actual locations of these modules is among them, isn't it?

johnczer commented 4 years ago

Ylianst is it possible to make the changes per above as this node_modules folder with minimist and node_windows still gets removed on upgrade and I have to replace it each time or service will not stay running.

MailYouLater commented 4 years ago

@johnczer: Next time you update could you check if this change also works for you?

        // Setup libraries
-        const args = require(path.join(cwd, 'node_modules/minimist'))(process.argv.slice(2));
+        const args = require(minimist)(process.argv.slice(2));
-        const nodewindows = require(path.join(cwd, 'node_modules/node-windows'));
+        const nodewindows = require(node-windows);
johnczer commented 4 years ago

I just tried this upgrade and I get the same result, which is it removes the expected node_modules folder from this path: C:\meshcentral\node_modules\meshcentral\ and I have to copy it back after every upgrade. Before I sent this I checked to see if the winservice.js was already modified with the above changes in 4.8-x. So I manually added those lines and still the same result. I added my suggestions back in and the service started and stayed running. It doesn't expect the node_modules in the path specified above, which is how I would expect it to behave.

Zveroloff commented 4 years ago

So, I'm experiencing the same issues. Once I installed MeshCentral (Windows Server 2016), I had to additionally install minimist and node-windows after cd to ./node-modules/meshcentral and before I was able to run node meshcentral --install. When I updated my installation, I had to install additional modules once again

dinger1986 commented 12 months ago

so old @si458 dont know if still relevant, I have installed on windows without any issues

si458 commented 12 months ago

closing as stale but also seems to be fixed as no reported issues recently 2023