Error: A dynamic link library (DLL) initialization routine failed
需要配置下面俩项
#ifdef _MSC_VER
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <delayimp.h>
#include <string.h>
static FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo *info) {
HMODULE m;
if (event != dliNotePreLoadLibrary)
return NULL;
if (_stricmp(info->szDll, "NODE.EXE") != 0)
return NULL;
m = GetModuleHandle(NULL);
return (FARPROC)m;
}
decltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook;
#endif

查看node.lib导出函数,主要有
uv
openssl
v8
zlib
dumpbin /LINKERMEMBER node.lib >nodelib.txt
修改node.lib为最后依赖
2017版本后依赖powershell脚本
$ExecutionContext.SessionState.LanguageMode 看看是不是为 FullLanguage
__PSLockdownPolicy 系统环境变量 为 1,如果为4为 ConstrainedLanguage。
另外说明我设置 npm config set msvs_version 2019 无效