在 Node webkit 上使用 phantom
Using phantom on Node webkit
我正在尝试使用 Phantom 抓取 Node webkit 中的动态内容。
我也将 phantomjs 添加到 env 变量中。
当我 运行 应用程序出现版本不匹配错误时:
"Uncaught Error: Module version mismatch. Expected 43, got 46."
通过 运行ning nw:version 我得到以下版本:
- nw.js v0.12.3
- io.js v1.2.0
- 铬 41.0.2272.76
我应该如何解决这个错误?
如果您能够使用其他包实现类似的功能,请告诉我。
必须重建本机模块 (phantom is one of them, my experience was with lwip) 才能在 nw.js 中工作;你用 npm 安装的不兼容。还建议安装 node.js 与 nw.js 使用的版本相匹配的版本(即 io.js 1.2.0)。
重建方法说明:https://github.com/nwjs/nw.js/wiki/build-native-modules-with-nw-gyp
基本上,你会
$ npm install -g nw-gyp
$ cd node_modules/phantom
$ nw-gyp configure --target=0.12.3
$ nw-gyp build
请注意配置中的“0.12.3”版本,因为这是您的 nw:version 显示的版本。
另外,请注意不同的先决条件,具体取决于您使用的 OS:https://github.com/nwjs/nw-gyp
为了在 nw.js 中进行网络抓取,我成功地使用了以下堆栈(在 Windows 7 上):
- nw.js 0.12.3
- phantomjs 带有 phantomjs 1.9.8 或 2.0.1b 的模块
- node-phantom-simple 模块
我正在尝试使用 Phantom 抓取 Node webkit 中的动态内容。 我也将 phantomjs 添加到 env 变量中。 当我 运行 应用程序出现版本不匹配错误时: "Uncaught Error: Module version mismatch. Expected 43, got 46." 通过 运行ning nw:version 我得到以下版本:
- nw.js v0.12.3
- io.js v1.2.0
- 铬 41.0.2272.76
我应该如何解决这个错误? 如果您能够使用其他包实现类似的功能,请告诉我。
必须重建本机模块 (phantom is one of them, my experience was with lwip) 才能在 nw.js 中工作;你用 npm 安装的不兼容。还建议安装 node.js 与 nw.js 使用的版本相匹配的版本(即 io.js 1.2.0)。
重建方法说明:https://github.com/nwjs/nw.js/wiki/build-native-modules-with-nw-gyp
基本上,你会
$ npm install -g nw-gyp
$ cd node_modules/phantom
$ nw-gyp configure --target=0.12.3
$ nw-gyp build
请注意配置中的“0.12.3”版本,因为这是您的 nw:version 显示的版本。 另外,请注意不同的先决条件,具体取决于您使用的 OS:https://github.com/nwjs/nw-gyp
为了在 nw.js 中进行网络抓取,我成功地使用了以下堆栈(在 Windows 7 上):
- nw.js 0.12.3
- phantomjs 带有 phantomjs 1.9.8 或 2.0.1b 的模块
- node-phantom-simple 模块