webhintio / hint

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

[Bug] On computers without a Node/NPM install, the VS Code extension doesn't work #4428

Open codepo8 opened 3 years ago

codepo8 commented 3 years ago

🐛 Bug report

Description

I just set up a new machine and installed VS Code and the Webhint extension without installing NPM and Node first. The extension fails to load hint then.

Error report

Error loading "hint" package from "/Users/chrisheilmann/Documents/GitHub/simple-to-do"
Trying to load shared version
Error loading shared "hint" package
Error: Cannot find module 'hint'
Require stack:
- /Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js
 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1019:15)
 at Function.resolve (internal/modules/cjs/helpers.js:78:19)
 at Object.loadPackage (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:40792)
 at i (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:42590)
 at Object.t.loadWebhint (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:43216)
 at t.Analyzer.initWebhint (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:37971)
 at t.Analyzer.validateTextDocument (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:38599)
 at /Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:36106
 at n.invoke (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:45659)
 at r.fire (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:46389) {
 code: 'MODULE_NOT_FOUND',
 requireStack: [
 '/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js'
 ]
}
Installing shared version of "hint"
Unable to install shared webhint instance Error: spawn npm ENOENT
 at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
 at onErrorNT (internal/child_process.js:469:16)
 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
 errno: 'ENOENT',
 code: 'ENOENT',
 syscall: 'spawn npm',
 path: 'npm',
 spawnargs: [ 'init', '-y' ]
}
Unable to load shared webhint instance Error: Cannot find module 'hint'
Require stack:
- /Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js
 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1019:15)
 at Function.resolve (internal/modules/cjs/helpers.js:78:19)
 at Object.loadPackage (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:40792)
 at i (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:42904)
 at processTicksAndRejections (internal/process/task_queues.js:97:5)
 at async t.Analyzer.initWebhint (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:37963)
 at async t.Analyzer.validateTextDocument (/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:38588)
 at async /Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js:2:36098 {
 code: 'MODULE_NOT_FOUND',
 requireStack: [
 '/Users/chrisheilmann/.vscode/extensions/webhint.vscode-webhint-1.5.11/dist/src/server.js'
 ]
}
antross commented 3 years ago

Thanks @codepo8!

@sarvaje @molant I think the best we can do here is detect that npm isn't available and give a better error message to the user (possibly pop a VS Code message dialog). Thoughts?

codepo8 commented 3 years ago

That would work. Maybe also add some documentation on how to debug when something goes wrong - as in - how to get a debug log.

On Thu, Mar 25, 2021, 21:40 Tony Ross @.***> wrote:

Thanks @codepo8 https://github.com/codepo8!

@sarvaje https://github.com/sarvaje @molant https://github.com/molant I think the best we can do here is detect that npm isn't available and give a better error message to the user (possibly pop a VS Code message dialog). Thoughts?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/webhintio/hint/issues/4428#issuecomment-807446813, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADJRCV6R7Y555R5UH3LFTTFONVTANCNFSM4ZXZUAYQ .