Skip to content

NOMINMAX missing to successfully rebuild for Electron v33.2.0 #2957

Open
@LeoLTM

Description

@LeoLTM

SerialPort Version

v12.0.0

Node Version

v20.18.1

Electron Version

v33.2.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Architecture

x64

Hardware or chipset of serialport

No response

What steps will reproduce the bug?

Setup an Vite Typescript Electron project, install serialport and Firmata using npm, run npm run start which runs

electron-forge start

What happens?

While preparing the application, the native dependencies are being rebuilt for the electron-internal Node.js version. This fails because there apparently are syntax errors in the "@serialport" dependency in Firmata.

The output is similar to this issue in the nan project.

I tried Node 18 - 22 and the problem occurred every single time.
The only way I was able to fix it was by manually adding the following to node_modules\firmata\node_modules\@serialport\bindings\binding.gyp

      'defines': [
          'NOMINMAX'
      ],

so that it looks like this:

      ['OS=="win"',
        {
            'defines': [
                'NOMINMAX'
            ],
          'sources': [
            'src/serialport_win.cpp'
          ],
          'msvs_settings': {
            'VCCLCompilerTool': {
              'ExceptionHandling': '2',
              'DisableSpecificWarnings': [ '4530', '4506' ],
            }
          }
        }
      ]

What should have happened?

The Firmata / SerialPort dependency should just rebuild for the Electron Node.js version like every other native dependency.

Additional information

Another project fixed this in their bindings.gyp like this (see here), that's why I thought it might fix it for serialport as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions