終電23時11分って早くね?

都内のIT企業で働くカラオケ大好きエンジニアの雑記

【解決済】Windows7でnpm install実行時にエラー

当方Windows7環境なのですが、
npm installを実行するとエラーが出た。

MSBUILD : error MSB3428: Visual C++ コンポーネント "VCBuild.exe" を読み込めませんでした。この問題を解決するには、次のいずれかを行ってください。 1) .NET Framework 2.0 SDK インス
トールする。 2) Microsoft Visual Studio 2005 をインストールする。
3) その他の場所にインストールされている場合、コンポーネントの場所をシステム パスに追加する。 [c:\Users\YourName\Desktop\Path\To\Your\Hubot\node_modules\hubot-xmpp
\node_modules\ltx\node_modules\node-expat\b
uild\binding.sln]

※3)のパスは適当に改変してます。

私はhubot-xmppを利用しようとして、

$ npm install hubot-xmpp --save

のコマンドを打った際にこのエラーが出ました。

今回の解決方法

今回の解決方法としては、
http://go.microsoft.com/?linkid=9816758
からMicrosoft Visual Studio C++ 2012 for Windows Desktop」をインストールしたことで解決した。

その他の解決方法

上記でダメであれば、
https://github.com/TooTallNate/node-gyp#installation
こちらのページの「On Windows」内の「Windows XP/Vista/7: 」か「Windows 7/8: 」の項目のいずれかを試してみるのがよさそうです。

下記の3つが挙げられています。

Microsoft Visual Studio C++ 2010のインストール。

Microsoft Visual Studio C++ 2010 (Express version works well)

http://go.microsoft.com/?linkid=9709949
上記URLからプログラムを直接ダウンロードしてインストール。

Microsoft Windows SDK for Windows 7 and .NET Framework 4 のインストール

For 64-bit builds of node and native modules you will also need the Windows 7 64-bit SDK

Download Microsoft Windows SDK for Windows 7 and .NET Framework 4 from Official Microsoft Download Center
上のURLから、Microsoft Windows SDK for Windows 7 and .NET Framework 4 のインストール。

Windows SDK 7.1 用 Microsoft Visual C++ 2010 Service Pack 1 コンパイラ更新プログラムを適応。

If you get errors that the 64-bit compilers are not installed you may also need the compiler update for the Windows SDK 7.1

Download Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1 from Official Microsoft Download Center
上記URLからWindows SDK 7.1 用 Microsoft Visual C++ 2010 Service Pack 1 コンパイラ更新プログラムを適応。


以上。同じようなエラーで困った人の助けになれば・・・