npm install for some packages (sqlite3, socket.io) fail with error MSB8020 on Windows 7

前端 未结 4 1978
野的像风
野的像风 2020-12-07 09:51

When trying to install some node.js packages (sqlite3 and socket.io in particular) using npm install socket.io on my Windows 7 machine with Visual Studio 2012 (

4条回答
  •  时光取名叫无心
    2020-12-07 10:15

    I have both Visual Studio Express 2013 and Visual Studio Community 2015 installed.

    I was getting C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 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 "Upgrade Solution...". [G:\work\cinema\node_modules\engine.io\node_modules\bufferutil\build\bufferutil.vcxproj]

    The reason was that the latest Node.js for Windows downloaded from https://nodejs.org contains an old npm v2 (and old node-gyp inside that npm v2).

    I had to update Node.js'es internal npm (which also updated node-gyp):

    (open console as an administrator)
    cd "C:\Program Files\nodejs"
    npm install npm@latest
    
    npm config set msvs_version 2013
    

    Now it works (seems that it's using VS 2013 for the time being)

提交回复
热议问题