node-jsdomをnpm installしようとしたらエラーになってハマった件

2017/09/23追記
**※コメント欄のご指摘のとおり、node-jsdomではなくjsdomを利用しましょう！**

-------

jQueryプラグインのテストコードを書くために、node-jsdomをnpmでインストールしようとしたところエラーになってちょっとハマってしまった…

## 環境

```
$ node --version
v8.5.0
```

## エラー内容

```
$ npm install node-jsdom

> contextify@0.1.15 install /Users/john/Documents/gitProjects/jquery.restore-scroll-position/node_modules/contextify
> node-gyp rebuild

  CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc:131:56: warning: 'NewInstance' is deprecated [-Wdeprecated-declarations]
        Local<Object> wrapper = Nan::New(constructor)->NewInstance();
                                                       ^
/Users/john/.node-gyp/8.5.0/include/node/v8.h:3792:52: note: 'NewInstance' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", Local<Object> NewInstance() const);
                                                   ^
../src/contextify.cc:150:16: error: no member named 'SetAccessCheckCallbacks' in 'v8::ObjectTemplate'
        otmpl->SetAccessCheckCallbacks(GlobalPropertyNamedAccessCheck,
        ~~~~~  ^
../src/contextify.cc:182:51: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
        Local<Value> rv = Nan::New(ctx->sandbox)->GetRealNamedProperty(property);
                                                  ^
/Users/john/.node-gyp/8.5.0/include/node/v8.h:3345:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
                Local<Value> GetRealNamedProperty(Local<String> key));
                             ^
../src/contextify.cc:209:38: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
        if (!Nan::New(ctx->sandbox)->GetRealNamedProperty(property).IsEmpty() ||
                                     ^
/Users/john/.node-gyp/8.5.0/include/node/v8.h:3345:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
                Local<Value> GetRealNamedProperty(Local<String> key));
                             ^
../src/contextify.cc:210:42: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
            !Nan::New(ctx->proxyGlobal)->GetRealNamedProperty(property).IsEmpty()) {
                                         ^
/Users/john/.node-gyp/8.5.0/include/node/v8.h:3345:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
                Local<Value> GetRealNamedProperty(Local<String> key));
                             ^
4 warnings and 1 error generated.
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/Cellar/node/8.5.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/john/Documents/gitProjects/jquery.restore-scroll-position/node_modules/contextify
gyp ERR! node -v v8.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! contextify@0.1.15 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.15 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/john/.npm/_logs/2017-09-22T04_45_20_795Z-debug.log
```

と、エラーになってしまう。

調べてみるとヒントになるページがあった。
https://blog.m157q.tw/posts/2017/09/01/error-contextify-0-1-15-install-node-gyp-rebuild/
上記のページを見るとnodeのバージョンが原因の様子。
自分の環境はbrewでNodeが入っていたのでバージョンを下げることにしました。

```
$ brew install node@6
$ brew switch node 6.7.0
$ node --version
v6.7.0
```

バージョンを8.5.0から6.7.0に変更して再度node-jsdomのインストールを行ったところ無事インストールが成功しました！

```
$ npm list --depth=0 | grep node-jsdom
└── node-jsdom@3.1.5
```

node-jsdomのインストールでエラーになった場合はnodeのバージョンを下げてみるといいかもしれません。