我是 Phantomjs 的新手,我刚刚下载了它的 Windows 版本。 我打开了 bin 文件夹并在 phantomjs.exe 中运行命令:
phantomjs hello.js
但它给了我错误:Expected an identifier bu found "hello"instead
然后我运行这个命令:
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 上运行命令,而是打开你的 cmd
关于javascript - Phantomjs 找不到 javascript 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30319025/