简体   繁体   English

PhantomJS期望使用标识符,但发现“本地”已插入

[英]PhantomJS expected an indentifier but found 'local' insted

Hi im insstall phantom js and create local.js file contains next code 您好,我安装了幻影js并创建了包含下一个代码的local.js文件

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 但是我在命令行中的runnin代码是错误的

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

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 . 您不是在运行脚本文件,而是试图访问一个名为local的变量,该变量将是带有js属性的对象。 When you run phantomjs this way is like a JavaScript console: you're executing JavaScript code. 当您运行phantomjs这种方式就像一个JavaScript控制台:您正在执行JavaScript代码。

If you want to run a script file you need to use the command-line interface (CLI) as follows: 如果要运行脚本文件,则需要使用命令行界面(CLI),如下所示:

phantomjs local.js phantomjs local.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM