ргдшщ
ргдшщ

Reputation: 83

PhantomJS expected an indentifier but found 'local' insted

Hi im insstall phantom js and create local.js file contains next code

var page = new WebPage(),
system = require('system'),
adress

if(system.args.length < 2){
    console.log("need adress");
    phantom.exit();

} else{
        console.log("im running")
        phantom.exit();
}

but wwen im runnin code in comand line im have error

phantomjs> local.js
expected an indentifier but found 'local' insted
phantomjs://repl-input:1 in global code

Upvotes: 0

Views: 198

Answers (1)

Mat&#237;as Fidemraizer
Mat&#237;as Fidemraizer

Reputation: 64943

You're not running your script file but you're trying to access a variable called local which would be an object with a property js. When you run phantomjs this way is like a JavaScript console: you're executing JavaScript code.

If you want to run a script file you need to use the command-line interface (CLI) as follows:

phantomjs local.js

Upvotes: 2

Related Questions