node-serialport icon indicating copy to clipboard operation
node-serialport copied to clipboard

Nanoserver support

Open desertspider opened this issue 7 years ago • 9 comments

Summary of Problem

  • What are you trying to do? Running zigbee2mqtt on nanoserver
  • What happens? Zigbee2mqtt crashes when connection to the zigbee stick
  • What should have happened? no crashes.

Thing this topic answers all questions about my problem; https://github.com/Koenkk/zigbee2mqtt/issues/1479

In short: zigbee2mqtt, bases on node.js with serialport does not work on nanoserver, but does work on servercore. Serialport probably uses an api not available on nanoserver. Question is. can serialport be fixed to be used on nanoserver, or what libraries should i sideload on nanoserver to make serialport work?

Versions, Operating System and Hardware

  • Node.js v node-v10.15.3-win-x64/node-v11.15.0-win-x64. (tried both)
  • Windows 1809

desertspider avatar May 04 '19 18:05 desertspider

What is nanoserver? What is servercore?

reconbot avatar May 04 '19 19:05 reconbot

What is nanoserver? What is servercore?

Servercore: https://docs.microsoft.com/nl-nl/windows-server/get-started/getting-started-with-nano-server "This is a base image for Windows Server containers. This image carries the Windows Server Core base OS image." aka Full windows server without GUI

Nano server: https://docs.microsoft.com/nl-nl/windows-server/get-started/getting-started-with-nano-server https://hub.docker.com/_/microsoft-windows-nanoserver Aka nano size version of full server version. It has a lite version of WIN32, with legacy API's removed. Supported APIs: https://msdn.microsoft.com/en-us/library/mt588480(v=vs.85).aspx

desertspider avatar May 04 '19 19:05 desertspider

We don’t use the uwp apis if that’s what it requires.

reconbot avatar May 05 '19 13:05 reconbot

We don’t use the uwp apis if that’s what it requires.

Well, for it to work on Nanoserver, it does.

desertspider avatar May 06 '19 10:05 desertspider

I think there’s some sort of shim you can add or compile in. Visual studio used to do that for windows 10 iot.

reconbot avatar May 06 '19 11:05 reconbot

Ok loaded Kernel32.dll and setupapi.dll by copying them in "C:\Windows\System32\Forwarders" and added the path to PATH. Got this error now;

<--- Last few GCs --->

[11076:0000018D3E71CB50]    86377 ms: Mark-sweep 1401.5 (1439.3) -> 1398.9 (1431.3) MB, 1787.8 / 0.1 ms  (+ 32.8 ms in 113 steps since start of marking, biggest step 12.2 ms, walltime since start of marking 2135 ms) (ave
rage mu = 0.237, current mu = 0.191[11076:0000018D3E71CB50]    88842 ms: Mark-sweep 1403.2 (1431.3) -> 1400.6 (1444.3) MB, 2254.2 / 0.0 ms  (average mu = 0.158, current mu = 0.086) allocation failure scavenge might not s
ucceed


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0000023EAB7D0481]
Security context: 0x03fb16b1d9f1 <JSObject>
    1: debug [0000033DB26EC771] [C:\app\node_modules\cc-znp\node_modules\debug\src\common.js:~67] [pc=0000023EAB7ED49B](this=0x03a7e9604981 <JSGlobal Object>)
    2: arguments adaptor frame: 1->0
    3: close [000001A812975A69] [C:\app\node_modules\cc-znp\node_modules\@serialport\stream\stream.js:424] [bytecode=000002762F45B589 offset=47](this=0x03ad7aa295...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

desertspider avatar May 06 '19 12:05 desertspider

I don’t know enough about windows to help here. I know for docker alpine and Ubuntu both work really well.

reconbot avatar May 06 '19 13:05 reconbot

To bad. Thanks for your help. Reason why i have to use Windows docker container is that com device pass-through is not supported to Linux containers on windows. I will use the full server core version for now.

desertspider avatar May 08 '19 07:05 desertspider

That’s a good reason.

reconbot avatar May 08 '19 11:05 reconbot