getting more information from phantomjs “SyntaxError: Parse error” message
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a long script that was not written by me. When i run it I get: phantomjs file.js SyntaxError: Parse error i checked out the manual and --help, and the best i could came up with was: phantomjs --debug=yes file.js (irrelevant debug statement from CookieJar) SyntaxError: Parse error Is there any better way to get at least a line number? or any hint at all? 回答1: Run the file with node . If there is a parse error it will report it. If the file is valid, then node will also try to run it, which will fail if your script depends on something