error MSB8020: The build tools for v120 (Platform Toolset = 'v120') cannot be found. To build using

error MSB8020: The build tools for v120 (Platform Toolset = ‘v120’) cannot be found. To build using the v120 build tools, please install v120 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting “Retarget solution”. [E:\aPritice\JieDe\app\node_modules\buffertools\build\buffertools.vcxproj]

最开始我执行了npm install -g windows-build-tools,然而不起作用还是一样的报错
通过卸载Visual Studio
并安装2017直接下载visual statiu 15 2017 C++工具地址https://download.visualstudio.microsoft.com/download/pr/11503713/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe
然后我去c盘下他说的文件夹,error MSB8020: The build tools for v120 (Platform Toolset = 'v120') cannot be found. To build using_第1张图片
手动复制14,粘贴12.0,然而不起作用
后来执行代码,

set GYP_MSVS_VERSION=2015
npm install --msvs_version=2015error MSB8020: The build tools for v120 (Platform Toolset = 'v120') cannot be found. To build using_第2张图片
在全局删除又下载了npm install node-gyp --globe,之前总报这个问题node-gyp的事,所以删除重装了
需要编译,因为用到了sqlite3,原生的库是需要编译的
尝试npm install electron-rebuild在执行“ ./node_modules/.bin/electron-rebuild” 之前发出“ ”
当执行完,还是不行,编译是成功进行了的,但是运行报错

error MSB8020: The build tools for v120 (Platform Toolset = 'v120') cannot be found. To build using_第3张图片
看网上有人这么做,操作一把,成功./node_modules/.bin/electron-rebuild -w keytar -p -f

参考:
https://github.com/atom/node-keytar/issues/51
https://github.com/nodejs/node-gyp/issues/679
https://stackoverflow.com/questions/32556295/npm-install-error-the-build-tools-for-v120-platform-toolset-v120-cannot
https://github.com/HDF-NI/hdf5.node/issues/98
https://github.com/nodegit/nodegit/issues/1034

不知道能否帮到别人,先记录下,以后有需要了看

你可能感兴趣的:(bug,electron)