我对phantomjs很陌生,我刚刚下载了它的windows版本。
我打开bin文件夹并在phantomjs.exe中运行命令:
phantomjs hello.js
但它给了我一个错误:应该是一个标识符,而不是找到“hello”
然后我运行这个命令:
hello.js
我得到这个错误:找不到变量hello
我的hello.js中有以下代码
console.log('Hello, world!');
phantom.exit();
我在同一个文件夹中有hello.js和phantomjs.exe,但找不到js文件。我在网上焦头烂额,但找不到合适的解决办法。
谢谢你的时间
最佳答案
我的错误是试图通过打开bin文件夹中的phantomjs.exe来执行命令。我打开windows cmd,转到phantomjs.exe的路径,这个命令起作用:
phantomjs hello.js
所以不要试图在phantomjs.exe上运行命令,而是打开您的命令