webhintio / hint

πŸ’‘ A hinting engine for the web

Home Page:https://webhint.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Getting an error in VS Code using the webhint extension.

cjboco opened this issue Β· comments

🐞 Bug report

Getting an error in VS Code using the webhint extension.

I was experiencing long saves, looked at the output tab and saw some errors. Disabled the extension and my long saves went away.

I've uninstalled and removed the "webhint.vscode-webhint" directory located here:
/Users/[USER]/Library/Application Support/Code/User/globalSorage/webhint.vscode-webhint/
... and then reinstalled. Got the same error message.

Details (dump from Output tab in vscode):

Found hint at /Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/hint/dist/src/lib/index.js
Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
    at module.exports (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
    at HTMLCanvasElementImpl.getContext (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
    at HTMLCanvasElement.getContext (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
    at eval (eval at evaluate (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/@hint/connector-local/dist/src/connector.js:244:38), <anonymous>:11327:49)
    at Object.get (eval at evaluate (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/@hint/connector-local/dist/src/connector.js:244:38), <anonymous>:5912:23)
    at isIconLigature (eval at evaluate (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/@hint/connector-local/dist/src/connector.js:244:38), <anonymous>:11326:41)
    at eval (eval at evaluate (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/@hint/connector-local/dist/src/connector.js:244:38), <anonymous>:21256:54)
    at Array.some (<anonymous>)
    at hasRealTextChildren (eval at evaluate (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/@hint/connector-local/dist/src/connector.js:244:38), <anonymous>:21255:35)
    at Rule.colorContrastMatches [as matches] (eval at evaluate (/Users/[USER]/Library/Application Support/Code/User/globalStorage/webhint.vscode-webhint/node_modules/@hint/connector-local/dist/src/connector.js:244:38), <anonymous>:21225:12) undefined

VS Code v1.77.1
macOS 12.6.3
node v16.13.2
webhint extension v2.1.9

npm install --save-dev canvas

do this and problem solve

No, it does not help

npm install --save-dev canvas

do this and problem solve

This did not fix my issue. Same error as above.

Also, not thrilled about installing a separate package, just to get this to work.

Getting this issue as well. Any update on this? The VS Code extension doesn't work because of this error.

Running cd ~/Library/Application\ Support/Code/User/globalStorage/webhint.vscode-webhint && npm install --save-dev canvas resolves the error.

Still same error

Hi everyone,

Unfortunately there are some known issues with canvas interaction, you can read more details in here:
https://webhint.io/docs/user-guide/troubleshoot/summary/

@shubhankar-mern @mohd-akram Thank you for the workarounds I'll make sure to add them to the guide in my next update.

As this has been resolved for most of the users hitting it I'll close it for now. @Ilkhom-S are you still hitting the issue, if so, could you open a new bug with more details as it might be something different? :)