philipwalton / html-inspector

HTML Inspector is a code quality tool to help you and your team write better markup. It's written in JavaScript and runs in the browser, so testing your HTML has never been easier.
2.32k stars 145 forks source link

CLI always errors "Error: spawn ENOENT" on any .html file I try #37

Closed mcandre closed 10 years ago

mcandre commented 10 years ago

Trace:

$ cat hello.html 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Hello World</title>
<link rel="stylesheet" href="hello.css" media="all" type="text/css" />
</head>
<body></body>
</html>

$ htmlinspector hello.html 
{ '0': { [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' } }

$ htmlinspector --version
0.7.0
philipwalton commented 10 years ago

There were actually two problems here. The first is I'm assuming you don't have PhantomJS installed. That should fix your error. If you're on mac just do:

brew install phantomjs

The second problem should be fixed by upgrading to 0.7.1. I discovered this bug while trying to debug your issue.

mcandre commented 10 years ago

@philipwalton Oh, excellent! I love when a package is on Homebrew!

Could we make this more evident, by:

  1. Noting in the README that phantomjs is a prerequisite
  2. Printing a more pertinent error message, along the lines of "Error: phantomjs is required, see https://github.com/philipwalton/html-inspector#getting-started for more information"
philipwalton commented 10 years ago

Agreed. I added some info to the REAME. When I get a chance I'll add some code that throws a warning if PhantomJS isn't installed.