node编译c++扩展时使用的编译工具依赖:python2.7开发一个windowsgadget,工作pc为ubuntu。在研究中...)因为node-gyp的编译问题一天半都没有解决,我猜测npm安装windows-build-tools可能需要参数辅助或者其他支持...如何正确安装使用node-gyp编译工具在这里做个记录,分为2种情况:不存在Node下载.msi安装包https://nodejs.org安装时(最好由管理员运行),勾选:Automaticallyinstallthenecessarytools...等待安装程序和PowerShell都执行完CompleteAlreadyexistNodeincludingnvmmanagementnode参考:https://github.com/nodejs/nod...https://github.com/Microsoft/...https://github.com/nodejs/nod。..https://nodejs.org/api/addons...https://www.jianshu.com/p/af7...https://blog.csdn.net/qq_3382...setpinstallChocolatey(powershell或cmd)//powershell(admin)Set-ExecutionPolicyBypass-ScopeProcess-Force;[System.Net.ServicePointManager]::SecurityProtocol=[System.Net.ServicePointManager]::SecurityProtocol-bor3072;iex((New-ObjectSystem.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))//cmd(admin)@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"-NoProfile-InputFormatNone-ExecutionPolicyBypass-Command"iex((New-ObjectSystem.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"&&SET"PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"installwindows-build-toolsbyChocolatey//install:VisualC++BuildTools//powershell/cmd(admin)choco安装visualcpp-build-tools-options:A如果未安装pythonchocoinstallpython2npmi-gnode-gypnpmconfigsetmsvs_version2017-gnode-gypinstallpowershell需要修改执行策略,执行:set-ExecutionPolicyRemoteSignednode-gypconfigure--msvs_version=2017可忽略如下错误gyp:binding.gypnotfound(cwd:C:\Windows\system32)whiletryingtoloadbinding.gypgypERR!stackError:`gyp`failedwithexitcode:1[可选]resolveerror:ifnotdefinednpm_config_node_gypwindows中2选1即可npmconfigsetnode_gyp"C:\Users\usr\AppData\Roaming\nvm\v12.14.1\node_modules\node-gyp\bin\node-gyp.js"-gsetnpm_config_node_gyp=节点C:\Users\usr\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js-gtest:npmi-Smcryptsqlite3node-sasskerberos
