josh3736 josh3736 - 1 year ago 56
Node.js Question

Prevent console window from being created in custom node.js build

I'm creating a custom build of node.js that should not show a console window to the user.

I've tried changing the linker config in the gyp file to

(which should set the linker flag
), but I still get a console window when I run the resulting node.exe binary.

How can I prevent the console window from appearing?

Edit: Further investigation reveals that the linker config in node.gyp is not taking effect. The generated node.vcxproj still has
(which is very strange to me, since adding
'UACUIAccess': 'true'
in the same part of node.gyp did take effect), so the built binary is incorrectly linked.

Answer Source

It appears that you must:

  • Comment out the 'SubSystem': 1 line in common.gypi. (Changing it to 2 causes the build to fail in mksnapshot.)
  • Change SubSystem to 2 in node.gyp
  • Also add 'EntryPointSymbol': 'wmainCRTStartup' to node.gyp.

This builds a node.exe that does not create a console window.