LoginSignup
2
1

More than 5 years have passed since last update.

jsdomのインストール

Last updated at Posted at 2015-03-22

個人用.
jsdomのインストールでハマったのでメモ.
window, navigatorオブジェクトは使わないのでコメントアウトして暫定対処とする.

実行環境

  • mac OS X Yosemite
  • Node.js v0.10.32

手順

$npm install jsdom

io.jsでコンテキストが呼び出し元と異なる問題で動作しないことが報告されている.
暫定対処としてコメントアウトする.
https://github.com/iojs/io.js/issues/855

yourProject/node_modules/jsdom/lib/jsdom/browser/Windows.js
>this._globalProxy = vm.runInContext("this", this);
<// this._globalProxy = vm.runInContext("this", this);
samplecode
var jsdom = require('jsdom').jsdom
global.document  = jsdom('<html><body></body></html>')
// global.window    = document.parentWindow => undifined
// global.navigator = window.navigator => errorとなる.
2
1
0

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
2
1