hint icon indicating copy to clipboard operation
hint copied to clipboard

[Bug] extension-vscode: Node and npm not found

Open robinloeffel opened this issue 1 year ago • 4 comments

🐞 Bug report

Description

Whenever I open my VS Code with the webhint extension enabled, I get greeted with the following message: “Ensure node and npm are installed to enable webhint to analyze source files.” As you can see in the attached screenshot, I indeed have both installed, however the extension does not work.

Screenshot 2024-10-26 at 10 07 52

Details

  • OS: macOS 15.0.1
  • VS Code: 1.94.2
  • Extension: 2.1.14
  • Node.js: 20.18.0 (via fnm)
  • npm: 10.8.2 (via fnm)

robinloeffel avatar Oct 26 '24 08:10 robinloeffel

Hi @robinloeffel,

Thanks for reporting this, I'll take a look. As a workaround you can use the Microsoft Edge Devtools extension for VSCCode. Webhint is part of it and could potentially solve your issue. Just please uninstall the webhint extension first as having both could lead to undesired behavior (we also have an open bug for this).

vidorteg avatar Nov 08 '24 23:11 vidorteg

Same here. To add details, I installed n via homebrew, which locates node's binary to: /opt/homebrew/bin/node

kalaschnik avatar Dec 15 '24 12:12 kalaschnik

Same here, but on a Windows machine.

jovilog avatar Jan 23 '25 10:01 jovilog

Same issue here (Debian 12.12, VSCodium 1.104.16282 flatpak, extension 2.1.14, node 22.18.0, npm 10.9.3). I looked in the output and found:

Error loading "hint" package from <project directory>
Trying to load shared version
Error loading shared "hint" package
Error: Cannot find module 'hint'
(...)
Installing shared version of "hint"
Unable to install shared webhint instance Error: spawn npm ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn npm',
  path: 'npm',
  spawnargs: [ 'init', '-y' ]
}
Unable to load shared webhint instance Error: Cannot find module 'hint'

So there's another potential workaround - it does work for me after running npm i -D hint and restarting extensions.

Incidentally, has webhint been abandoned? Even dependabot seems to have given up on it 11 months ago, and the install came with 11 deprecation warnings and 70 vulnerabilities.

cypressSap avatar Oct 01 '25 02:10 cypressSap