防止在自定义 node.js 构建中创建控制台窗口 [英] Prevent console window from being created in custom node.js build
问题描述
我正在创建 node.js 的自定义构建,它不应向用户显示控制台窗口.
I'm creating a custom build of node.js that should not show a console window to the user.
我尝试更改 gyp 文件中的 链接器配置 到 2
(应该设置链接器 flag /SUBSYSTEM:WINDOWS
),但是当我运行生成的 node.exe 二进制文件时,我仍然看到一个控制台窗口.
I've tried changing the linker config in the gyp file to 2
(which should set the linker flag /SUBSYSTEM:WINDOWS
), but I still get a console window when I run the resulting node.exe binary.
如何防止控制台窗口出现?
How can I prevent the console window from appearing?
进一步调查显示 node.gyp 中的链接器配置未生效.生成的node.vcxproj还有
(这对我来说很奇怪,因为添加了'UACUIAccess': 'true'
在 node.gyp 的同一部分确实生效),因此构建的二进制文件链接不正确.
Further investigation reveals that the linker config in node.gyp is not taking effect. The generated node.vcxproj still has <Link><SubSystem>Console</SubSystem></Link>
(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.
推荐答案
看来你必须:
- 注释掉 'SubSystem': 1 行="nofollow">common.gypi.(将其更改为
2
会导致 mksnapshot 中的构建失败.) - 将node.gyp
- 同时将
'EntryPointSymbol': 'wmainCRTStartup'
添加到 node.gyp.
- Comment out the
'SubSystem': 1
line in common.gypi. (Changing it to2
causes the build to fail in mksnapshot.) - Change
SubSystem
to2
in node.gyp - Also add
'EntryPointSymbol': 'wmainCRTStartup'
to node.gyp.
这会构建一个不创建控制台窗口的 node.exe.
This builds a node.exe that does not create a console window.
这篇关于防止在自定义 node.js 构建中创建控制台窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!