Phantomjs: unknown modular system

Phantomjs version 1.4 (the latest version is available through apt). I have one js file with this content:

var page = require('webpage').create(); var system = require('system'); 

When I ran it using:

 phantomjs testscript.js 

I get an error message:

 undefined:0 Unknown module system for require() 

What does it mean? What causes this? I tried to run the example from https://github.com/ariya/phantomjs/blob/master/examples/direction.js , but it seems I can not find the simplest job. Is there any other way to read command line arguments than using the system?

+4
source share
1 answer

Update to the latest version (1.9.1). See: How to configure and run PhantomJS on Ubuntu?

Compile your own version:

 sudo apt-get update sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev git clone git://github.com/ariya/phantomjs.git cd phantomjs git checkout 1.9 ./build.sh 

Note that you need to symbolically link to / usr / bin / etc from your dir

+1
source

Source: https://habr.com/ru/post/1481534/


All Articles