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.
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
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
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.
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.
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.