Windowsで npm install 時にエラー

1. Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT

Windows10 に aglio をインストールしようとしていて以下のエラーが出たので。

gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
gyp ERR! stack     at onErrorNT (internal/child_process.js:362:16)
gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:139:11)
gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:181:9)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files (x86)\\Nodist\\v-x64\\8.17.0\\node.exe" "C:\\Program Files (x86)\\Nodist\\npmv\\6.9.0\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\projects\samples\aglio-demo\node_modules\protagonist
gyp ERR! node -v v8.17.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/nodejs/node-gyp/issues>

MSBuild.exe のパスが違うので設定してあげる。

npm config set msvs_version 2017
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"

2. おまけ

ちなみに

npm config set msvs_version 2019

KeyError: '2019'

となって駄目だった。