Troubleshoot webhint installation and runtime issues
User guide
- Getting Started
Api
Concepts
Configurations
Configuring webhint
Connectors
Development flow integration
Extensions
Formatters
Hints
- Avoid CSS limits
- Avoid HTTP redirects
- axe accessibility check
- Babel configuration hint set
- Compatibility of CSS, HTML and JavaScript features
- Correct `Content-Type` header
- Correct manifest extension
- Correct viewport
- Detect CSS Reflows
- Disallowed HTTP headers
- External links disown opener
- Has web app manifest
- Highest document mode
- HTTP cache
- Leading '.' in `classList.add` or `classList.remove`
- Manifest has name
- Minify JavaScript
- Modern DOCTYPE
- No `createElement` with SVG
- No `P3P` headers
- No broken links
- No byte-order mark
- No Inline CSS Styles
- No protocol-relative URLs
- No small error pages
- No vulnerable libraries
- Nu HTML test
- Optimal compression
- Optimize images
- Performance budget
- Prefixed CSS first
- scoped-svg-styles
- Specify button type
- SSL server test
- TypeScript configuration hints set
- Unneeded HTTP headers
- Use `Strict-Transport-Security` header
- Use `X-Content-Type-Options` header
- Use Apple touch icon
- Use charset `utf-8`
- Use HTTPS
- Use subresource integrity
- Valid `Set-Cookie` header
- Valid `theme-color`
- Valid manifest
- webpack configuration hints set
Parsers
Server configurations
Troubleshoot
- Api
- Concepts
- Configurations
- Configuring webhint
- Connectors
- Development flow integration
- Extensions
- Formatters
- Hints
- Parsers
- Server configurations
- Troubleshoot
Troubleshoot webhint installation and runtime issues
This topic contains the most common issues reported by users along with potential fixes. If you encounter an undocumented error, please open an issue on GitHub.
NOTE:
webhint
is supported on the most recent LTS and Current version of Node.js. You should use the x64 version of webhint.
Windows Subsystem Linux
If you choose to use Windows Subsystem Linux (WSL) to build your packages, you may receive errors related to the following binary packages.
canvas
iltorb
You may receive an error similar to the following example.
Info looking for cached prebuild @ /home/mahome/.npm/_prebuilds/47fbee-iltorb-v2.4.3-node-v59-linux-x64.tar.gz WARN install No prebuilt binaries found (target=9.10.0 runtime=node arch=x64 libc= platform=linux) gyp ERR! build error gyp ERR! stack Error: not found: make |
To resolve this error, you must install the prerequisites of the packages.
IMPORTANT: You should not use WSL to run
webhint
due to the dependency on Puppeteer.
To enable webhint
to run on WSL, add the following code snippet to your
.hintrc file.
{ "extends": ["web-recommended"], "connector": "jsdom" } |
To run webhint
with a configuration (.hintrc) file without installing it,
run the following command.
npx hint -c ./path/to/.hintrc https://example.com |
Building Windows packages
You may receive the following error depending on the settings of your development environment or if there was a problem downloading any of the pre-compiled native modules of webhint.
gyp ERR! stack Error: Can't find Python executable "python" |
Recent versions of Node.js (version 10 or later) on Windows display a prompt for you to install any required dependencies.
Alternatively, you may manually install the windows-build-tools.
In an Elevated PowerShell prompt, run the command in the following code snippet.
npm install --global windows-build-tools
Issues with canvas
Starting with connector-jsdom v1.1.0
, canvas
is now an optional
dependency. You
may receive some issues during the installation if the binary is not available
for download, but the overall process should finish running and you should be
able to run webhint
using the jsdom
connector. The only caveat is images
are not downloaded.
The following circumstances are more likely to cause errors.
- A new release of Node.js is available, but pre-compiled binaries for
canvas
are not yet available. - You are running the x86 version of Node.js on Windows. To fix the error, you should switch to x64 since x86 binaries may not be published any time soon.
If you want to compile canvas, go to Compiling.
Permission issues during installation
If you receive an EACCES
permission error while you install webhint
, your
project may not have webhint
installed as a devDependency
.
To install
webhint
as adevDependency
for your project, run the following command:npm install hint --save-dev
If you are not able to install webhint
as a devDependency
,
change the default directory for npm
. After changing the the default directory, try to install it again.
For more information about how to change the npm default directory, go to Manually change the npm default directory .
According to npm documentation, if you have Node.js installed using a package manager like Homebrew or nvm, you may may not have to change the directories because you have the correct default permissions.
hint-cli Missing Browser Error
If you receive an error related to a missing browser you may not have a suitable Chromium based browser installed.
hint-cli
will check for an installation of
Chrome,
Chromium,
or Edge, in that order, dependent on your
operating system, to run the tests.