LoginSignup
14
16

More than 5 years have passed since last update.

Windows10でsocket.ioインストールエラー

Last updated at Posted at 2015-09-02

Windows10にOSあげて、クリーンインストールしたので開発環境を再構築したところ、
思った以上に手間取ったのでメモ

環境

  • Windows10
  • node v0.12.7
  • npm 2.11.3
  • express 4.13.3
  • socket.io 1.3.6

やったこと

1.socket.io以外をインストール

nodeとnpm,expressをインストール。ここまでは順調なので割愛

2. socket.ioをインストール

npm install socket.ioをコマンドプロンプトから実行

2.1 python2.7がないのでconfigrator動かないと怒られる

→黙ってインストール

2.2 node-gyp rebuildが実行されるもエラー

MSBUILDできないとか怒られるので
VisualStudio2015も出たことだし2015インストールすればいっかと思いインストール
↑これがよくなかった

2.3 warning MSB8003: Could not find WindowsSDKDir variable from the registry.と表示され後処理でエラー

C:\Users*\hoge\node_modules\socket.io\node_modules\engine
.io\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_g
yp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_
modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
このソリューション内のプロジェクトを 1 度に 1 つずつビルドします。並行ビルドを有
効にするには、"/m" スイッチを追加してください。
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targe
ts(366,5): warning MSB8003: Could not find WindowsSDKDir variable from the regi
stry. TargetFrameworkVersion or PlatformToolset may be set to an invalid versi
on number. [C:\Users*\hoge\node_modules\socket.io\node_m
odules\engine.io\node_modules\ws\node_modules\utf-8-validate\build\validation.v
cxproj]
TRACKER : error TRK0005: 検索できませんでした: "CL.exe"。指定されたファイルが見
つかりません。 [C:\Users*\hoge\node_modules\socket.io\node_modules\engine.io\node_mod
ules\ws\node_modules\utf-8-validate\build\validation.vcxproj]
\

gyp ERR! build error
stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with
exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074
:12)
ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modu
les\node-gyp\bin\node-gyp.js" "rebuild"
ERR! cwd C:\Users*\hoge\node_modules\socket.io\node_modul
es\engine.io\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok

ここに書いてるレジストリいじってみるも効果なし
https://github.com/nodejs/node-gyp/issues/555
→ここにnode-gyp v2.00以降ならVS2015でもいけるみたいなこと書いてたけどbuild失敗

2.4 結論はVisualStudio2012インストール

nodeのバージョンの整合探すのに疲れたので、目先の改善策を模索・・・。
下記を参照させていただきました。
http://qiita.com/oahiroaki/items/b1a0cbea06c5ea140800
VS2015入れたのでVS2012入れたくなかったのですがインストールしてnpm installを再実行

C:\Users*\hoge> npm install socket.io --msvs_version=2012
utf-8-validate @1.1.0 install C:\Users*\hoge\node_module
s\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
node-gyp rebuild
C:\Users*\hoge\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_
modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
このソリューション内のプロジェクトを 1 度に 1 つずつビルドします。並行ビルドを有効にするには、"/m" スイッチを追加してください。
validation.cc
ライブラリ C:\Users*\hoge\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.lib とオブジェクト C:\Users*\hoge\node_modules\
socket .io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate\build\
Release\validation.exp を作成中
コード生成しています。
コード生成が終了しました。
validation.vcxproj -> C:\Users*\hoge\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.node
/

build成功して無事インストール済みました。--msvs_version=2012がポイントですね。

結論としてはWindows10は何も悪くないということですね。

14
16
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
16