I am trying to scrape dynamic content in Node webkit by using Phantom .
I have added phantomjs to env variable also.
When i run the application i get a version mismatch error:
"Uncaught Error: Module version mismatch. Expected 43, got 46."
By running nw:version i get the following versions:
- nw.js v0.12.3
- io.js v1.2.0
- Chromium 41.0.2272.76
How should i get around this error?
If you were able to implement similar functionality using some other package, let me know.
Native modules (phantom is one of them, my experience was with lwip) must be rebuilt to work inside nw.js; the ones you install with npm are not compatible. It is also recommended to install node.js version matching that which is used by nw.js (i.e. io.js 1.2.0).
The instruction on how to rebuild: https://github.com/nwjs/nw.js/wiki/build-native-modules-with-nw-gyp
Basically, you would
$ npm install -g nw-gyp
$ cd node_modules/phantom
$ nw-gyp configure --target=0.12.3
$ nw-gyp build
Note "0.12.3" version in configure because that's what your nw:version shows.
Also, note different pre-requisites depending on which OS you use: https://github.com/nwjs/nw-gyp
To do web-scarping in nw.js I successfully use the following stack (on Windows 7):
- nw.js 0.12.3
- phantomjs module with phantomjs 1.9.8 or 2.0.1b
- node-phantom-simple module