webhintio / hint

💡 A hinting engine for the web
https://webhint.io/
Apache License 2.0
3.62k stars 670 forks source link

[Bug] Not able to run webhint hint for angular7 project #2324

Closed MiHawkStackOverFlow closed 5 years ago

MiHawkStackOverFlow commented 5 years ago

I installed webhint into my angular7 project but I am getting the following error while running hint on the local server:-

{ ResourceError: Module ../build/Release/canvas.node not found when loading @hint/connector-jsdom at Object.exports.tryToLoadFrom (C:\Users\Neutron\Desktop\Angular2\library\node_modules\hint\dist\src\lib\utils\resource-loader.js:141:19) at getResource (C:\Users\Neutron\Desktop\Angular2\library\node_modules\hint\dist\src\lib\utils\resource-loader.js:148:30) at sources.some (C:\Users\Neutron\Desktop\Angular2\library\node_modules\hint\dist\src\lib\utils\resource-loader.js:210:21) at Array.some () at Object.exports.loadResource (C:\Users\Neutron\Desktop\Angular2\library\node_modules\hint\dist\src\lib\utils\resource-loader.js:209:13) at Object.exports.loadResources (C:\Users\Neutron\Desktop\Angular2\library\node_modules\hint\dist\src\lib\utils\resource-loader.js:294:29) at exports.default (C:\Users\Neutron\Desktop\Angular2\library\node_modules\hint\dist\src\lib\cli\analyze.js:196:36) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:744:11) at startup (internal/bootstrap/node.js:285:19) name: 'ResourceError', status: 'DependencyError' }

I have a branch feat-accessibility on my project at https://github.com/MiHawkStackOverFlow/Anime-Library-Angular7.

Follow the steps once on branch to reproduce this issue:-

  1. npm install
  2. open project in vs code and open 2 terminals
  3. one terminal run ng serve and other run 'npm run hint -- http://localhost:4200'
antross commented 5 years ago

@MiHawkStackOverFlow Thanks for the report!

Yes, we've had some periodic trouble with the canvas dependency for @hint/connector-jsdom as it requires pre-built binaries which sometimes aren't available or fail to download. You could try reinstalling the canvas module (or running it's install script directly) to see if that helps. Uninstalling/deleting the canvas package may also help if you don't need to fetch images as it's an optional dependency.

Alternatively you could try using webhint's @hint/connector-chrome instead which doesn't require the canvas module (but does require having some version of Chrome installed): https://webhint.io/docs/user-guide/concepts/connectors/#built-in-connectors-and-platform-support

molant commented 5 years ago

There hasn't been any activity for the last 18 days so we are going to assume @antross suggestions fixed it. If not please let us know!