Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web scraping with CasperJS returns strange error that isn't documented

I wrote an web scraping script with CasperJS and it works perfectly on Mac OS 10.10.4 with CasperJS version 1.1.0-beta3 and PhantomJS version 1.9.8, but when I put the same script on one of my servers which is Ubuntu 14.04 (running inside Docker container) with the same environment (CasperJS and PhantomJS all the same versions) it suddenly just outputs this:

I'm `fs` modules

Which is pretty strange. One of my suggestion is that in this script I am also trying to require some other scripts with require like that:

var parsingStrategy = require(strategiesPath + strategyName);

and the path to those strategies is correct I already checked that. All the other stuff that I'm doing in this script are just normal CasperJS stuff which are documented and work well I think.

like image 905
fre2ak Avatar asked Jul 22 '15 19:07

fre2ak


1 Answers

Okay guys I have an answer for you - the 'fs' is a module bundled with node, so it doesn't have to be installed through npm. The package you downloaded is this: https://www.npmjs.com/package/fs and all it contains is...

console.log("I'm `fs` modules");

When you did:

npm uninstall fs

npm install -g fs

The node used its local package - that it shipped with - and ignored the global one entirely. Mystery solved. ;)

like image 93
wap300 Avatar answered Nov 15 '22 10:11

wap300